"""repository for focus object, breakpoints, watchpoints, etc.
msghead_dbx
= "DBX-" + msghead
# a global id counter to generate unique ids for watchpoints, breakpoints,
# etc. Use Repository.nextid() to receive the next available id.
"""function used to generate a unique id for watchpoints, breakpoints, etc.
"""class that serves as repository for shared data
globals - top level globals(), so that we can eval() expression in
other places as they are at top level.
# the current focus module, in original string
# the corresponding riesling backend module
# 1 means in rioesling interpreter mode, otherwise in normal python
# 1 means output message will be printed
# pointer (as uint64_t) to backend system object
# array to cpu/core/strand objects
# used in sam mode to indicate whether blaze is running or not,
# blaze must be in 'stop" mode when conduct breakpoint operaiton.
# this variable remains as 0 when not in sam mode.
# keep track of blaze numcpu and corresponding pmask
# indicate the type of cpu architecture, e.g., n2, etc
def addBreakpoint (self
, breakpoint
):
if self
.breakpoints
.has_key(breakpoint
.id):
raise KeyError, "duplicated breakpoint id %d" % breakpoint
.id
self
.breakpoints
[breakpoint
.id] = breakpoint
def deleteBreakpoint (self
, id):
if self
.breakpoints
.has_key(idstr
):
del self
.breakpoints
[idstr
]
raise KeyError, "does not have breakpoint with id=%s" % idstr
def showBreakpoint (self
, focus
=None):
ids
= self
.breakpoints
.keys()
bpoint
= self
.breakpoints
[id]
if (focus
== None) or (focus
== bpoint
.modSrc
):
result
.append("id=%s, mod=%s, cmd='%s', action=%s" % (bpoint
.id, bpoint
.modSrc
, bpoint
.src
, bpoint
.action
))
def addWatchpoint (self
, watchpoint
):
if self
.watchpoints
.has_key(watchpoint
.id):
raise KeyError, "duplicated watchpoint id %d" % watchpoint
.id
self
.watchpoints
[watchpoint
.id] = watchpoint
def showWatchpoint (self
):
ids
= self
.watchpoints
.keys()
wpoint
= self
.watchpoints
[id]
result
.append("id=%s, disable=%d, cmd='%s', watch='%s', action=%s" % (wpoint
.id, wpoint
.disable
, wpoint
.src
, wpoint
.watch
, wpoint
.action
))
result
.append("DBX: id=%s, watchExpr=%s" % (wpoint
.id, wpoint
.watchExpr
)) #dbx
if __name__
== "__main__":