about summary refs log tree commit diff stats
path: root/example/symbol_exec/depgraph.py
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2023-04-23 12:12:35 +0200
committerCamille Mougey <commial@gmail.com>2023-04-23 12:12:35 +0200
commitd32bf6385d393a70a01d4481435a683ad1e66fbe (patch)
treedbd441ef4d5965ac0dab2ab4bdc2ca67b6a9fe69 /example/symbol_exec/depgraph.py
parent00d4fd4b9e68fa744ed57b31044c5cf53f85293a (diff)
downloadmiasm-d32bf6385d393a70a01d4481435a683ad1e66fbe.tar.gz
miasm-d32bf6385d393a70a01d4481435a683ad1e66fbe.zip
Depgraph: add `.address_to_location` to help find the line and loc of an address
Diffstat (limited to 'example/symbol_exec/depgraph.py')
-rw-r--r--example/symbol_exec/depgraph.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/example/symbol_exec/depgraph.py b/example/symbol_exec/depgraph.py
index a7df2e25..61dbd4b4 100644
--- a/example/symbol_exec/depgraph.py
+++ b/example/symbol_exec/depgraph.py
@@ -79,16 +79,11 @@ dg = DependencyGraph(
 
 # Build information
 target_addr = int(args.target_addr, 0)
-current_loc_key = next(iter(ircfg.getby_offset(target_addr)))
-assignblk_index = 0
-current_block = ircfg.get_block(current_loc_key)
-for assignblk_index, assignblk in enumerate(current_block):
-    if assignblk.instr.offset == target_addr:
-        break
+target = dg.address_to_location(target_addr)
 
 # Enumerate solutions
 json_solutions = []
-for sol_nb, sol in enumerate(dg.get(current_block.loc_key, elements, assignblk_index, set())):
+for sol_nb, sol in enumerate(dg.get(target["loc_key"], elements, target["line_nb"], set())):
     fname = "sol_%d.dot" % sol_nb
     with open(fname, "w") as fdesc:
             fdesc.write(sol.graph.dot())