diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-12-11 14:26:23 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-06-08 17:35:05 +0200 |
| commit | a2637cdf0b40df074865d23a7fd71f082ad7f40a (patch) | |
| tree | f6c958ca8481e6e29760078e5d1bdc2d2b64da53 /example/disasm/callback.py | |
| parent | dadfaabc3fff5edb9bf4ef7e7e8c4cfc4baccb94 (diff) | |
| download | miasm-a2637cdf0b40df074865d23a7fd71f082ad7f40a.tar.gz miasm-a2637cdf0b40df074865d23a7fd71f082ad7f40a.zip | |
Expr: Add new word ExprLoc
This word represents a location in the binary. Thus, the hack of ExprId containing an AsmLabel ends here.
Diffstat (limited to 'example/disasm/callback.py')
| -rw-r--r-- | example/disasm/callback.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/example/disasm/callback.py b/example/disasm/callback.py index a9bef20b..6b7b2b81 100644 --- a/example/disasm/callback.py +++ b/example/disasm/callback.py @@ -1,5 +1,5 @@ from miasm2.core.bin_stream import bin_stream_str -from miasm2.core.asmblock import AsmLabel, AsmConstraint, expr_is_label +from miasm2.core.asmblock import AsmLabel, AsmConstraint from miasm2.arch.x86.disasm import dis_x86_32, cb_x86_funcs @@ -23,10 +23,12 @@ def cb_x86_callpop(cur_bloc, symbol_pool, *args, **kwargs): return ## The destination must be a label dst = last_instr.args[0] - if not expr_is_label(dst): + if not dst.is_label(): return + + label = symbol_pool.loc_key_to_label(dst.loc_key) ## The destination must be the next instruction - if dst.name.offset != last_instr.offset + last_instr.l: + if label.offset != last_instr.offset + last_instr.l: return # Update instruction instance @@ -34,7 +36,7 @@ def cb_x86_callpop(cur_bloc, symbol_pool, *args, **kwargs): # Update next blocks to process in the disassembly engine cur_bloc.bto.clear() - cur_bloc.add_cst(dst.name.offset, AsmConstraint.c_next, symbol_pool) + cur_bloc.add_cst(label.offset, AsmConstraint.c_next, symbol_pool) # Prepare a tiny shellcode |