Beispiel #1
0
    def setup_cpu_instr_trace(self, with_regs):
        if not log_instr.isEnabledFor(logging.INFO):
            log_instr.setLevel(logging.INFO)
        cpu = self.cpu
        state = CPUState()
        if with_regs:

            def instr_hook():
                # add register dump
                state.get(cpu)
                res = state.dump()
                for r in res:
                    log_instr.info(r)
                # disassemble line
                pc = cpu.r_reg(REG_PC)
                self.trace_code_line(pc)

        else:

            def instr_hook():
                # disassemble line
                pc = cpu.r_reg(REG_PC)
                self.trace_code_line(pc)

        self.machine.set_instr_hook(instr_hook)
Beispiel #2
0
 def setup_cpu_instr_trace(self, with_regs):
   if not log_instr.isEnabledFor(logging.INFO):
     log_instr.setLevel(logging.INFO)
   cpu = self.cpu
   state = CPUState()
   if with_regs:
     def instr_hook():
       # add register dump
       state.get(cpu)
       res = state.dump()
       for r in res:
         log_instr.info(r)
       # disassemble line
       pc = cpu.r_reg(REG_PC)
       self.trace_code_line(pc)
   else:
     def instr_hook():
       # disassemble line
       pc = cpu.r_reg(REG_PC)
       self.trace_code_line(pc)
   self.machine.set_instr_hook(instr_hook)