Skip to content

Commit

Permalink
Fixing locating first-use variables from disassembly (angr#2499)
Browse files Browse the repository at this point in the history
* added initial fixes to find the closest decompilation line for an instruction

* added some fix for better locating of close instructions

* Fixed a bug in tabing to first use variables from disass

* fixed spelling
  • Loading branch information
mahaloz authored Jan 28, 2021
1 parent 7701d10 commit 0c24d4d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions angr/analyses/decompiler/structured_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,21 @@ def mapper(chunks, posmap, stmt_posmap, insmap):
elif isinstance(obj, CExpression) and hasattr(obj, 'tags') and \
obj.tags is not None and 'ins_addr' in obj.tags:

# assure that variables are only placed once in the GUI at the defenition of each var
# assure that variables are only placed once in the GUI at the definition of each var
if isinstance(obj, CVariable):
posmap.add_mapping(pos, len(s), obj)

if obj not in used_cvars:
used_cvars.append(obj)
stmt_posmap.add_mapping(pos, len(s), obj)
insmap.add_mapping(obj.tags['ins_addr'], pos)
else:
posmap.add_mapping(pos, len(s), obj)

else:
stmt_posmap.add_mapping(pos, len(s), obj)
insmap.add_mapping(obj.tags['ins_addr'], pos)

# if we are not another type, just add to the default posmap
else:
# if we are a CVariable add to the mapping
elif isinstance(obj, CVariable):
posmap.add_mapping(pos, len(s), obj)

pos += len(s)
yield s

Expand Down

0 comments on commit 0c24d4d

Please sign in to comment.