Added show trace data option to Qt disassembly display.
This commit is contained in:
parent
0a70f46a9f
commit
236fb67b7d
|
@ -514,6 +514,18 @@ QMenuBar *ConsoleDebugger::buildMenuBar(void)
|
|||
|
||||
viewMenu->addAction(act);
|
||||
|
||||
// View -> Show Trace Data
|
||||
g_config->getOption( "SDL.AsmShowTraceData", &opt );
|
||||
|
||||
act = new QAction(tr("Show &Trace Data"), this);
|
||||
//act->setShortcut(QKeySequence( tr("F7") ) );
|
||||
act->setStatusTip(tr("Show &Trace Data"));
|
||||
act->setCheckable(true);
|
||||
act->setChecked(opt);
|
||||
connect( act, SIGNAL(triggered(bool)), this, SLOT(displayTraceDataCB(bool)) );
|
||||
|
||||
viewMenu->addAction(act);
|
||||
|
||||
// View -> Display ROM Offsets
|
||||
g_config->getOption( "SDL.AsmShowRomOffsets", &opt );
|
||||
|
||||
|
@ -2469,6 +2481,13 @@ void ConsoleDebugger::displayByteCodesCB( bool value )
|
|||
asmView->setDisplayByteCodes(value);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void ConsoleDebugger::displayTraceDataCB( bool value )
|
||||
{
|
||||
g_config->setOption( "SDL.AsmShowTraceData", value );
|
||||
|
||||
asmView->setDisplayTraceData(value);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void ConsoleDebugger::displayROMoffsetCB( bool value )
|
||||
{
|
||||
g_config->setOption( "SDL.AsmShowRomOffsets", value );
|
||||
|
@ -3471,6 +3490,11 @@ void QAsmView::updateAssemblyView(void)
|
|||
}
|
||||
}
|
||||
|
||||
if ( showTraceData )
|
||||
{
|
||||
asmFlags |= ASM_DEBUG_TRACES;
|
||||
}
|
||||
|
||||
for (int i=0; i < 0xFFFF; i++)
|
||||
{
|
||||
line.clear();
|
||||
|
@ -4690,11 +4714,13 @@ QAsmView::QAsmView(QWidget *parent)
|
|||
|
||||
isPopUp = false;
|
||||
showByteCodes = false;
|
||||
showTraceData = false;
|
||||
displayROMoffsets = false;
|
||||
symbolicDebugEnable = true;
|
||||
registerNameEnable = true;
|
||||
|
||||
g_config->getOption( "SDL.AsmShowByteCodes" , &showByteCodes );
|
||||
g_config->getOption( "SDL.AsmShowTraceData" , &showTraceData );
|
||||
g_config->getOption( "SDL.AsmShowRomOffsets", &displayROMoffsets );
|
||||
g_config->getOption( "SDL.DebuggerShowSymNames", &symbolicDebugEnable );
|
||||
g_config->getOption( "SDL.DebuggerShowRegNames", ®isterNameEnable );
|
||||
|
@ -4989,6 +5015,18 @@ void QAsmView::setDisplayByteCodes( bool value )
|
|||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void QAsmView::setDisplayTraceData( bool value )
|
||||
{
|
||||
if ( value != showTraceData )
|
||||
{
|
||||
showTraceData = value;
|
||||
|
||||
fceuWrapperLock();
|
||||
updateAssemblyView();
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void QAsmView::setDisplayROMoffsets( bool value )
|
||||
{
|
||||
if ( value != displayROMoffsets )
|
||||
|
|
|
@ -142,6 +142,7 @@ class QAsmView : public QWidget
|
|||
void setSymbolDebugEnable( bool value );
|
||||
void setRegisterNameEnable( bool value );
|
||||
void setDisplayByteCodes( bool value );
|
||||
void setDisplayTraceData( bool value );
|
||||
int getCtxMenuLine(void){ return ctxMenuLine; };
|
||||
int getCtxMenuAddr(void){ return ctxMenuAddr; };
|
||||
int getCtxMenuAddrType(void){ return ctxMenuAddrType; };
|
||||
|
@ -256,6 +257,7 @@ class QAsmView : public QWidget
|
|||
bool registerNameEnable;
|
||||
bool mouseLeftBtnDown;
|
||||
bool showByteCodes;
|
||||
bool showTraceData;
|
||||
bool isPopUp;
|
||||
|
||||
};
|
||||
|
@ -577,6 +579,7 @@ class ConsoleDebugger : public QDialog
|
|||
void resetCountersCB (void);
|
||||
void reloadSymbolsCB(void);
|
||||
void displayByteCodesCB(bool value);
|
||||
void displayTraceDataCB(bool value);
|
||||
void displayROMoffsetCB(bool value);
|
||||
void symbolDebugEnableCB(bool value);
|
||||
void registerNameEnableCB(bool value);
|
||||
|
|
|
@ -794,6 +794,10 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugS
|
|||
static char chr[8]={0};
|
||||
uint16_t tmp,tmp2;
|
||||
char stmp[128], stmp2[128];
|
||||
bool symDebugEnable, showTrace;
|
||||
|
||||
symDebugEnable = (flags & ASM_DEBUG_SYMS ) ? true : false;
|
||||
showTrace = (flags & ASM_DEBUG_TRACES) ? true : false;
|
||||
|
||||
//these may be replaced later with passed-in values to make a lighter-weight disassembly mode that may not query the referenced values
|
||||
#define RX (X.X)
|
||||
|
@ -871,14 +875,18 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugS
|
|||
_indirectx:
|
||||
indirectX(tmp);
|
||||
|
||||
if ( flags )
|
||||
if ( symDebugEnable )
|
||||
{
|
||||
sym = replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s ($%02X,X) @ %s = #$%02X", chr,opcode[1],stmp,GetMem(tmp));
|
||||
showTrace
|
||||
? sprintf(str,"%s ($%02X,X) @ %s = #$%02X", chr,opcode[1],stmp,GetMem(tmp))
|
||||
: sprintf(str,"%s ($%02X,X)", chr,opcode[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(str,"%s ($%02X,X) @ $%04X = #$%02X", chr,opcode[1],tmp,GetMem(tmp));
|
||||
showTrace
|
||||
? sprintf(str,"%s ($%02X,X) @ $%04X = #$%02X", chr,opcode[1],tmp,GetMem(tmp))
|
||||
: sprintf(str,"%s ($%02X,X)", chr,opcode[1]);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -907,14 +915,18 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugS
|
|||
_zeropage:
|
||||
// ################################## Start of SP CODE ###########################
|
||||
// Change width to %04X // don't!
|
||||
if ( flags )
|
||||
if ( symDebugEnable )
|
||||
{
|
||||
sym = replaceSymbols( flags | ASM_DEBUG_ADDR_02X, opcode[1], stmp );
|
||||
sprintf(str,"%s %s = #$%02X", chr,stmp,GetMem(opcode[1]));
|
||||
showTrace
|
||||
? sprintf(str,"%s %s = #$%02X", chr,stmp,GetMem(opcode[1]))
|
||||
: sprintf(str,"%s %s", chr,stmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(str,"%s $%02X = #$%02X", chr,opcode[1],GetMem(opcode[1]));
|
||||
showTrace
|
||||
? sprintf(str,"%s $%02X = #$%02X", chr,opcode[1],GetMem(opcode[1]))
|
||||
: sprintf(str,"%s $%02X", chr,opcode[1]);
|
||||
}
|
||||
// ################################## End of SP CODE ###########################
|
||||
break;
|
||||
|
@ -961,14 +973,18 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugS
|
|||
_absolute:
|
||||
absolute(tmp);
|
||||
|
||||
if ( flags )
|
||||
if ( symDebugEnable )
|
||||
{
|
||||
sym = replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s %s = #$%02X", chr,stmp,GetMem(tmp));
|
||||
showTrace
|
||||
? sprintf(str,"%s %s = #$%02X", chr,stmp,GetMem(tmp))
|
||||
: sprintf(str,"%s %s", chr,stmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(str,"%s $%04X = #$%02X", chr,tmp,GetMem(tmp));
|
||||
showTrace
|
||||
? sprintf(str,"%s $%04X = #$%02X", chr,tmp,GetMem(tmp))
|
||||
: sprintf(str,"%s $%04X", chr,tmp);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -984,7 +1000,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugS
|
|||
_branch:
|
||||
relative(tmp);
|
||||
|
||||
if ( flags )
|
||||
if ( symDebugEnable )
|
||||
{
|
||||
sym = replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s %s", chr,stmp);
|
||||
|
@ -1007,14 +1023,18 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugS
|
|||
_indirecty:
|
||||
indirectY(tmp);
|
||||
|
||||
if ( flags )
|
||||
if ( symDebugEnable )
|
||||
{
|
||||
sym = replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s ($%02X),Y @ %s = #$%02X", chr,opcode[1],stmp,GetMem(tmp));
|
||||
showTrace
|
||||
? sprintf(str,"%s ($%02X),Y @ %s = #$%02X", chr,opcode[1],stmp,GetMem(tmp))
|
||||
: sprintf(str,"%s ($%02X),Y", chr,opcode[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(str,"%s ($%02X),Y @ $%04X = #$%02X", chr,opcode[1],tmp,GetMem(tmp));
|
||||
showTrace
|
||||
? sprintf(str,"%s ($%02X),Y @ $%04X = #$%02X", chr,opcode[1],tmp,GetMem(tmp))
|
||||
: sprintf(str,"%s ($%02X),Y", chr,opcode[1]);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1039,14 +1059,18 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugS
|
|||
zpIndex(tmp,RX);
|
||||
// ################################## Start of SP CODE ###########################
|
||||
// Change width to %04X // don't!
|
||||
if ( flags )
|
||||
if ( symDebugEnable )
|
||||
{
|
||||
sym = replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s $%02X,X @ %s = #$%02X", chr,opcode[1],stmp,GetMem(tmp));
|
||||
showTrace
|
||||
? sprintf(str,"%s $%02X,X @ %s = #$%02X", chr,opcode[1],stmp,GetMem(tmp))
|
||||
: sprintf(str,"%s $%02X,X", chr,opcode[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(str,"%s $%02X,X @ $%04X = #$%02X", chr,opcode[1],tmp,GetMem(tmp));
|
||||
showTrace
|
||||
? sprintf(str,"%s $%02X,X @ $%04X = #$%02X", chr,opcode[1],tmp,GetMem(tmp))
|
||||
: sprintf(str,"%s $%02X,X", chr,opcode[1]);
|
||||
}
|
||||
// ################################## End of SP CODE ###########################
|
||||
break;
|
||||
|
@ -1064,15 +1088,19 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugS
|
|||
_absolutey:
|
||||
absolute(tmp);
|
||||
tmp2=(tmp+RY);
|
||||
if ( flags )
|
||||
if ( symDebugEnable )
|
||||
{
|
||||
sym = replaceSymbols( flags, tmp , stmp );
|
||||
sym2 = replaceSymbols( flags, tmp2, stmp2 );
|
||||
sprintf(str,"%s %s,Y @ %s = #$%02X", chr,stmp,stmp2,GetMem(tmp2));
|
||||
showTrace
|
||||
? sprintf(str,"%s %s,Y @ %s = #$%02X", chr,stmp,stmp2,GetMem(tmp2))
|
||||
: sprintf(str,"%s %s,Y", chr,stmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(str,"%s $%04X,Y @ $%04X = #$%02X", chr,tmp,tmp2,GetMem(tmp2));
|
||||
showTrace
|
||||
? sprintf(str,"%s $%04X,Y @ $%04X = #$%02X", chr,tmp,tmp2,GetMem(tmp2))
|
||||
: sprintf(str,"%s $%04X,Y", chr,tmp);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1095,15 +1123,19 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugS
|
|||
_absolutex:
|
||||
absolute(tmp);
|
||||
tmp2=(tmp+RX);
|
||||
if ( flags )
|
||||
if ( symDebugEnable )
|
||||
{
|
||||
sym = replaceSymbols( flags, tmp , stmp );
|
||||
sym2 = replaceSymbols( flags, tmp2, stmp2 );
|
||||
sprintf(str,"%s %s,X @ %s = #$%02X", chr,stmp,stmp2,GetMem(tmp2));
|
||||
showTrace
|
||||
? sprintf(str,"%s %s,X @ %s = #$%02X", chr,stmp,stmp2,GetMem(tmp2))
|
||||
: sprintf(str,"%s %s,X", chr,stmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(str,"%s $%04X,X @ $%04X = #$%02X", chr,tmp,tmp2,GetMem(tmp2));
|
||||
showTrace
|
||||
? sprintf(str,"%s $%04X,X @ $%04X = #$%02X", chr,tmp,tmp2,GetMem(tmp2))
|
||||
: sprintf(str,"%s $%04X,X", chr,tmp);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1114,7 +1146,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugS
|
|||
_jump:
|
||||
absolute(tmp);
|
||||
|
||||
if ( flags )
|
||||
if ( symDebugEnable )
|
||||
{
|
||||
sym = replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s %s", chr,stmp);
|
||||
|
@ -1132,14 +1164,18 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugS
|
|||
zpIndex(tmp,RY);
|
||||
// ################################## Start of SP CODE ###########################
|
||||
// Change width to %04X // don't!
|
||||
if ( flags )
|
||||
if ( symDebugEnable )
|
||||
{
|
||||
sym = replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s $%02X,Y @ %s = #$%02X", chr,opcode[1],stmp,GetMem(tmp));
|
||||
showTrace
|
||||
? sprintf(str,"%s $%02X,Y @ %s = #$%02X", chr,opcode[1],stmp,GetMem(tmp))
|
||||
: sprintf(str,"%s $%02X,Y", chr,opcode[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(str,"%s $%02X,Y @ $%04X = #$%02X", chr,opcode[1],tmp,GetMem(tmp));
|
||||
showTrace
|
||||
? sprintf(str,"%s $%02X,Y @ $%04X = #$%02X", chr,opcode[1],tmp,GetMem(tmp))
|
||||
: sprintf(str,"%s $%02X,Y", chr,opcode[1]);
|
||||
}
|
||||
// ################################## End of SP CODE ###########################
|
||||
break;
|
||||
|
|
|
@ -185,6 +185,7 @@ int generateNLFilenameForAddress(int address, char *NLfilename);
|
|||
#define ASM_DEBUG_REGS 0x0002
|
||||
#define ASM_DEBUG_REPLACE 0x0004
|
||||
#define ASM_DEBUG_ADDR_02X 0x0008
|
||||
#define ASM_DEBUG_TRACES 0x0010
|
||||
|
||||
int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str, debugSymbol_t *symOut = NULL, debugSymbol_t *symOut2 = NULL );
|
||||
|
||||
|
|
|
@ -1148,7 +1148,7 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
|
|||
char asmTxt[256];
|
||||
unsigned int addr = X.PC;
|
||||
static int unloggedlines = 0;
|
||||
int asmFlags = 0;
|
||||
int asmFlags = ASM_DEBUG_TRACES;
|
||||
|
||||
rec.cpu.PC = X.PC;
|
||||
rec.cpu.A = X.A;
|
||||
|
@ -1178,7 +1178,7 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
|
|||
|
||||
if (logging_options & LOG_SYMBOLIC)
|
||||
{
|
||||
asmFlags = ASM_DEBUG_SYMS | ASM_DEBUG_REGS;
|
||||
asmFlags |= ASM_DEBUG_SYMS | ASM_DEBUG_REGS;
|
||||
}
|
||||
|
||||
// if instruction executed from the RAM, skip this, log all instead
|
||||
|
|
|
@ -611,6 +611,7 @@ InitConfig()
|
|||
config->addOption("SDL.AsmSyntaxColorComment", "");
|
||||
config->addOption("SDL.AsmSyntaxColorPC", "");
|
||||
config->addOption("SDL.AsmShowByteCodes", 0);
|
||||
config->addOption("SDL.AsmShowTraceData", 0);
|
||||
config->addOption("SDL.AsmShowRomOffsets", 0);
|
||||
config->addOption("SDL.DebuggerShowSymNames", 1);
|
||||
config->addOption("SDL.DebuggerShowRegNames", 1);
|
||||
|
|
Loading…
Reference in New Issue