mirror of https://github.com/stella-emu/stella.git
added trace logging like z26 (fixes #204)
This commit is contained in:
parent
d6224a8a6e
commit
efa09ebcbb
|
@ -1007,6 +1007,7 @@ clearSaveStateIfs - Clear all saveState points
|
||||||
loadAllStates - Load all emulator states
|
loadAllStates - Load all emulator states
|
||||||
loadState - Load emulator state xx (0-9)
|
loadState - Load emulator state xx (0-9)
|
||||||
logBreaks - Logs breaks and traps and continues emulation
|
logBreaks - Logs breaks and traps and continues emulation
|
||||||
|
logTrace - Logs emulation (note: emulation may slow down and the log becomes huge soon)
|
||||||
n - Negative Flag: set (0 or 1), or toggle (no arg)
|
n - Negative Flag: set (0 or 1), or toggle (no arg)
|
||||||
palette - Show current TIA palette
|
palette - Show current TIA palette
|
||||||
pc - Set Program Counter to address xx
|
pc - Set Program Counter to address xx
|
||||||
|
|
|
@ -485,7 +485,6 @@ void Debugger::log(string_view triggerMsg)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CartDebug::DisassemblyTag& tag = disasm.list[pos];
|
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
|
|
||||||
msg << std::left << std::setw(10) << std::setfill(' ') << triggerMsg;
|
msg << std::left << std::setw(10) << std::setfill(' ') << triggerMsg;
|
||||||
|
@ -515,13 +514,17 @@ void Debugger::log(string_view triggerMsg)
|
||||||
else
|
else
|
||||||
msg << " ";
|
msg << " ";
|
||||||
|
|
||||||
|
if(disasm.list.size() > pos)
|
||||||
|
{
|
||||||
|
const CartDebug::DisassemblyTag& tag = disasm.list[pos];
|
||||||
|
|
||||||
msg << Base::HEX4 << pc << " "
|
msg << Base::HEX4 << pc << " "
|
||||||
<< std::left << std::setw(8) << std::setfill(' ') << tag.bytes << " "
|
<< std::left << std::setw(8) << std::setfill(' ') << tag.bytes << " "
|
||||||
<< tag.disasm.substr(0, 7);
|
<< tag.disasm.substr(0, 7);
|
||||||
|
|
||||||
if(tag.disasm.length() > 8)
|
if(tag.disasm.length() > 8)
|
||||||
msg << tag.disasm.substr(8);
|
msg << tag.disasm.substr(8);
|
||||||
|
}
|
||||||
Logger::log(msg.str());
|
Logger::log(msg.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1796,6 +1796,16 @@ void DebuggerParser::executeLogBreaks()
|
||||||
commandResult << "logBreaks " << (enable ? "enabled" : "disabled");
|
commandResult << "logBreaks " << (enable ? "enabled" : "disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void DebuggerParser::executeLogTrace()
|
||||||
|
{
|
||||||
|
const bool enable = !debugger.mySystem.m6502().getLogTrace();
|
||||||
|
|
||||||
|
debugger.mySystem.m6502().setLogTrace(enable);
|
||||||
|
settings.setValue("dbg.logtrace", enable);
|
||||||
|
commandResult << "logTrace " << (enable ? "enabled" : "disabled");
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// "n"
|
// "n"
|
||||||
void DebuggerParser::executeN()
|
void DebuggerParser::executeN()
|
||||||
|
@ -3361,6 +3371,16 @@ DebuggerParser::CommandArray DebuggerParser::commands = { {
|
||||||
std::mem_fn(&DebuggerParser::executeLogBreaks)
|
std::mem_fn(&DebuggerParser::executeLogBreaks)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"logTrace",
|
||||||
|
"Toggle emulation logging",
|
||||||
|
"Example: logBreaks",
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
{ Parameters::ARG_END_ARGS },
|
||||||
|
std::mem_fn(&DebuggerParser::executeLogTrace)
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"n",
|
"n",
|
||||||
"Negative Flag: set (0 or 1), or toggle (no arg)",
|
"Negative Flag: set (0 or 1), or toggle (no arg)",
|
||||||
|
|
|
@ -101,7 +101,7 @@ class DebuggerParser
|
||||||
std::array<Parameters, 10> parms;
|
std::array<Parameters, 10> parms;
|
||||||
std::function<void (DebuggerParser*)> executor;
|
std::function<void (DebuggerParser*)> executor;
|
||||||
};
|
};
|
||||||
using CommandArray = std::array<Command, 110>;
|
using CommandArray = std::array<Command, 111>;
|
||||||
static CommandArray commands;
|
static CommandArray commands;
|
||||||
|
|
||||||
struct Trap
|
struct Trap
|
||||||
|
@ -211,6 +211,7 @@ class DebuggerParser
|
||||||
void executeLoadConfig();
|
void executeLoadConfig();
|
||||||
void executeLoadState();
|
void executeLoadState();
|
||||||
void executeLogBreaks();
|
void executeLogBreaks();
|
||||||
|
void executeLogTrace();
|
||||||
void executeN();
|
void executeN();
|
||||||
void executePalette();
|
void executePalette();
|
||||||
void executePc();
|
void executePc();
|
||||||
|
|
|
@ -411,6 +411,11 @@ void PromptWidget::loadConfig()
|
||||||
print(DebuggerParser::inverse(" logBreaks enabled "));
|
print(DebuggerParser::inverse(" logBreaks enabled "));
|
||||||
extra = true;
|
extra = true;
|
||||||
}
|
}
|
||||||
|
if(instance().settings().getBool("dbg.logtrace"))
|
||||||
|
{
|
||||||
|
print(DebuggerParser::inverse(" logTrace enabled "));
|
||||||
|
extra = true;
|
||||||
|
}
|
||||||
if(extra)
|
if(extra)
|
||||||
print("\n");
|
print("\n");
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ void M6502::reset()
|
||||||
myReadFromWritePortBreak = devSettings ? mySettings.getBool("dev.rwportbreak") : false;
|
myReadFromWritePortBreak = devSettings ? mySettings.getBool("dev.rwportbreak") : false;
|
||||||
myWriteToReadPortBreak = devSettings ? mySettings.getBool("dev.wrportbreak") : false;
|
myWriteToReadPortBreak = devSettings ? mySettings.getBool("dev.wrportbreak") : false;
|
||||||
myLogBreaks = mySettings.getBool("dbg.logbreaks");
|
myLogBreaks = mySettings.getBool("dbg.logbreaks");
|
||||||
|
myLogTrace = mySettings.getBool("dbg.logtrace");
|
||||||
|
|
||||||
myLastBreakCycle = ULLONG_MAX;
|
myLastBreakCycle = ULLONG_MAX;
|
||||||
}
|
}
|
||||||
|
@ -317,6 +318,14 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(myLogTrace && myDebugger)
|
||||||
|
{
|
||||||
|
// Make sure that the TIA state matches the current system clock.
|
||||||
|
// Else Scanlines, Cycles and Pixels are not updated for logging.
|
||||||
|
mySystem->tia().updateEmulation();
|
||||||
|
myDebugger->log("trace");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int cond = evalCondSaveStates();
|
const int cond = evalCondSaveStates();
|
||||||
|
|
|
@ -268,6 +268,8 @@ class M6502 : public Serializable
|
||||||
void setWriteToReadPortBreak(bool enable) { myWriteToReadPortBreak = enable; }
|
void setWriteToReadPortBreak(bool enable) { myWriteToReadPortBreak = enable; }
|
||||||
void setLogBreaks(bool enable) { myLogBreaks = enable; }
|
void setLogBreaks(bool enable) { myLogBreaks = enable; }
|
||||||
bool getLogBreaks() const { return myLogBreaks; }
|
bool getLogBreaks() const { return myLogBreaks; }
|
||||||
|
void setLogTrace(bool enable) { myLogTrace = enable; }
|
||||||
|
bool getLogTrace() const { return myLogTrace; }
|
||||||
#endif // DEBUGGER_SUPPORT
|
#endif // DEBUGGER_SUPPORT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -486,6 +488,7 @@ class M6502 : public Serializable
|
||||||
bool myWriteToReadPortBreak{false}; // trap on writes to read ports
|
bool myWriteToReadPortBreak{false}; // trap on writes to read ports
|
||||||
bool myStepStateByInstruction{false};
|
bool myStepStateByInstruction{false};
|
||||||
bool myLogBreaks{false}; // log breaks/taps and continue emulation
|
bool myLogBreaks{false}; // log breaks/taps and continue emulation
|
||||||
|
bool myLogTrace{false}; // log emulation
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
|
|
|
@ -235,6 +235,7 @@ Settings::Settings()
|
||||||
setPermanent("dbg.uhex", "false");
|
setPermanent("dbg.uhex", "false");
|
||||||
setPermanent("dbg.ghostreadstrap", "true");
|
setPermanent("dbg.ghostreadstrap", "true");
|
||||||
setPermanent("dbg.logbreaks", "false");
|
setPermanent("dbg.logbreaks", "false");
|
||||||
|
setPermanent("dbg.logtrace", "false");
|
||||||
setPermanent("dbg.autosave", "false");
|
setPermanent("dbg.autosave", "false");
|
||||||
setPermanent("dis.resolve", "true");
|
setPermanent("dis.resolve", "true");
|
||||||
setPermanent("dis.gfxformat", "2");
|
setPermanent("dis.gfxformat", "2");
|
||||||
|
@ -743,6 +744,7 @@ void Settings::usage()
|
||||||
<< " -dbg.ghostreadstrap <1|0> Debugger traps on 'ghost' reads\n"
|
<< " -dbg.ghostreadstrap <1|0> Debugger traps on 'ghost' reads\n"
|
||||||
<< " -dbg.uhex <0|1> Lower-/uppercase HEX display\n"
|
<< " -dbg.uhex <0|1> Lower-/uppercase HEX display\n"
|
||||||
<< " -dbg.logbreaks <0|1> Log breaks and traps and continue emulation\n"
|
<< " -dbg.logbreaks <0|1> Log breaks and traps and continue emulation\n"
|
||||||
|
<< " -dbg.logtrace <0|1> Log emulation\n"
|
||||||
<< " -dbg.autosave <0|1> Automatically save breaks, traps etc.\n"
|
<< " -dbg.autosave <0|1> Automatically save breaks, traps etc.\n"
|
||||||
<< " -break <address> Set a breakpoint at 'address'\n"
|
<< " -break <address> Set a breakpoint at 'address'\n"
|
||||||
<< " -debug Start in debugger mode\n"
|
<< " -debug Start in debugger mode\n"
|
||||||
|
|
Loading…
Reference in New Issue