diff options
| author | Camille Mougey <commial@gmail.com> | 2023-04-23 12:12:35 +0200 |
|---|---|---|
| committer | Camille Mougey <commial@gmail.com> | 2023-04-23 12:12:35 +0200 |
| commit | d32bf6385d393a70a01d4481435a683ad1e66fbe (patch) | |
| tree | dbd441ef4d5965ac0dab2ab4bdc2ca67b6a9fe69 /example | |
| parent | 00d4fd4b9e68fa744ed57b31044c5cf53f85293a (diff) | |
| download | miasm-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')
| -rw-r--r-- | example/symbol_exec/depgraph.py | 9 |
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()) |