diff options
| author | Camille Mougey <commial@gmail.com> | 2019-01-14 12:42:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-14 12:42:04 +0100 |
| commit | 056ef4cd26c98cd8b9c121f2a791c01c5a7052a8 (patch) | |
| tree | 322b5bfa158bf165b9bae70dd5d2d62cffbf363c /miasm2/jitter/codegen.py | |
| parent | e336cf92c44bf87c09a18bdafb716ef398077fda (diff) | |
| parent | fcdc5f9e1f48c284c8626112c802868313afaa2e (diff) | |
| download | miasm-056ef4cd26c98cd8b9c121f2a791c01c5a7052a8.tar.gz miasm-056ef4cd26c98cd8b9c121f2a791c01c5a7052a8.zip | |
Merge pull request #935 from serpilliere/fix_jit_pc_updt
Jitter: fix pc update in trace mode
Diffstat (limited to '')
| -rw-r--r-- | miasm2/jitter/codegen.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/miasm2/jitter/codegen.py b/miasm2/jitter/codegen.py index 32af29a2..a9405472 100644 --- a/miasm2/jitter/codegen.py +++ b/miasm2/jitter/codegen.py @@ -392,11 +392,13 @@ class CGen(object): ) return out - def gen_post_code(self, attrib): + def gen_post_code(self, attrib, pc_value): """Callback to generate code AFTER the instruction execution @attrib: Attributes instance""" out = [] if attrib.log_regs: + # Update PC for dump_gpregs + out.append("%s = %s;" % (self.C_PC, pc_value)) out.append('dump_gpregs(jitcpu->cpu);') return out @@ -408,7 +410,7 @@ class CGen(object): out = [] if isinstance(dst, Expr): - out += self.gen_post_code(attrib) + out += self.gen_post_code(attrib, "DST_value") out.append('BlockDst->address = DST_value;') out += self.gen_post_instr_checks(attrib) out.append('\t\treturn JIT_RET_NO_EXCEPTION;') @@ -423,11 +425,11 @@ class CGen(object): offset in instr_offsets): # Only generate goto for next instructions. # (consecutive instructions) - out += self.gen_post_code(attrib) + out += self.gen_post_code(attrib, "0x%x" % offset) out += self.gen_post_instr_checks(attrib) out.append('goto %s;' % dst) else: - out += self.gen_post_code(attrib) + out += self.gen_post_code(attrib, "0x%x" % offset) out.append('BlockDst->address = DST_value;') out += self.gen_post_instr_checks(attrib) out.append('\t\treturn JIT_RET_NO_EXCEPTION;') |