From 130547fa89ebae931d9d3c858027aa7a72d88de4 Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Wed, 28 Oct 2020 20:37:39 -0400 Subject: [PATCH] Added symbolic debug replacement functionality during disassembly on Qt trace logger. --- src/drivers/Qt/TraceLogger.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/drivers/Qt/TraceLogger.cpp b/src/drivers/Qt/TraceLogger.cpp index 54291f8b..5849198c 100644 --- a/src/drivers/Qt/TraceLogger.cpp +++ b/src/drivers/Qt/TraceLogger.cpp @@ -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; }