Added symbolic debug replacement functionality during disassembly on Qt trace logger.

This commit is contained in:
Matthew Budd 2020-10-28 20:37:39 -04:00
parent cde409dece
commit 130547fa89
1 changed files with 14 additions and 3 deletions

View File

@ -25,6 +25,7 @@
#include "Qt/dface.h"
#include "Qt/input.h"
#include "Qt/config.h"
#include "Qt/SymbolicDebug.h"
#include "Qt/fceuWrapper.h"
#define LOG_REGISTERS 0x00000001
@ -917,8 +918,10 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
traceRecord_t rec;
char asmTxt[256];
unsigned int addr = X.PC;
static int unloggedlines = 0;
int asmFlags = 0;
rec.cpu.PC = X.PC;
rec.cpu.A = X.A;
@ -946,6 +949,11 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
}
rec.cycleCount = counter_value;
if ( logging_options & LOG_SYMBOLIC )
{
asmFlags = ASM_DEBUG_SYMS | ASM_DEBUG_REGS;
}
// if instruction executed from the RAM, skip this, log all instead
// TODO: loops folding mame-lyke style
if (rec.romAddr != -1)
@ -994,7 +1002,7 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
break;
case 1:
{
a = Disassemble(addr + 1, opcode);
DisassembleWithDebug(addr + 1, opcode, asmFlags, asmTxt);
// special case: an RTS opcode
if (opcode[0] == 0x60)
{
@ -1007,13 +1015,16 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
rec.callAddr = call_addr;
}
}
a = asmTxt;
break;
}
case 2:
a = Disassemble(addr + 2, opcode);
DisassembleWithDebug(addr + 2, opcode, asmFlags, asmTxt);
a = asmTxt;
break;
case 3:
a = Disassemble(addr + 3, opcode);
DisassembleWithDebug(addr + 3, opcode, asmFlags, asmTxt);
a = asmTxt;
break;
}