Skip to content

Commit

Permalink
Pretty mem/cell loc in Widening Info Dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-carciofini committed Oct 31, 2024
1 parent ab40c05 commit 22324ea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 12 additions & 0 deletions pate_binja/pate.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,17 @@ def __init__(self, raw: dict):
self.equalityTraceCollection = TraceCollection('Equality', ltv['value'])
self.sharedEnv = raw['shared_env']

def prettyLoc(self, loc: dict) -> str:
id = loc.get('ptr',{}).get('offset',{}).get('symbolic_ident')
if not id:
return '1 ' + str(loc)
matches = [x['symbolic_expr'] for x in self.sharedEnv if x['symbolic_ident'] == id]
if not matches:
return '2 ' + str(loc)
with io.StringIO() as out:
pprint_symbolic(out, matches[0])
return out.getvalue()


class CFARNode:
exits: list[CFARNode]
Expand Down Expand Up @@ -1842,6 +1853,7 @@ def run_pate_demo():
replay = file.endswith('.replay')
user = TtyUserInteraction(not replay)
pate = PateWrapper(file, user)
#pate.debug_cfar = True
pate.run()


3 changes: 1 addition & 2 deletions pate_binja/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,8 +1049,7 @@ def updateEqValSelection(self):
item.setData(Qt.UserRole, traces)

for (loc, traces) in traceCollection.cellTraces:
locStr = str(loc)
#locStr = pate.get_mem_desc(m)
locStr = wInfo.prettyLoc(loc)
item = QListWidgetItem(locStr, self.locList)
item.setData(Qt.UserRole, traces)

Expand Down

0 comments on commit 22324ea

Please sign in to comment.