diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2019-01-13 21:52:39 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2019-01-13 21:52:39 +0100 |
| commit | fcdc5f9e1f48c284c8626112c802868313afaa2e (patch) | |
| tree | 30a010b762dde9dd3fb8a159770902553a86604e /miasm2/jitter/codegen.py | |
| parent | 7f12d5bf72e9a236c71845e932c37352c5df642a (diff) | |
| download | miasm-fcdc5f9e1f48c284c8626112c802868313afaa2e.tar.gz miasm-fcdc5f9e1f48c284c8626112c802868313afaa2e.zip | |
Jitter: fix pc update in trace mode
Diffstat (limited to 'miasm2/jitter/codegen.py')
| -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;') |