mirror of https://github.com/stella-emu/stella.git
Add new debugger command 'stepwhile'.
This command steps through the code instruction-by-instruction (just like the 'step' command) while the <condition> argument evaluates to true. This is a (pretty slow) workaround for breakpoints and the 'run' command which seems broken from debugging scripts.
This commit is contained in:
parent
e6b5d792b7
commit
7010400235
|
@ -1766,6 +1766,23 @@ void DebuggerParser::executeStep()
|
||||||
<< "executed " << dec << debugger.step() << " cycles";
|
<< "executed " << dec << debugger.step() << " cycles";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
// "stepwhile"
|
||||||
|
void DebuggerParser::executeStepwhile()
|
||||||
|
{
|
||||||
|
int res = YaccParser::parse(argStrings[0].c_str());
|
||||||
|
if(res != 0) {
|
||||||
|
commandResult << red("invalid expression");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Expression* expr = YaccParser::getResult();
|
||||||
|
int ncycles = 0;
|
||||||
|
do {
|
||||||
|
ncycles += debugger.step();
|
||||||
|
} while (expr->evaluate());
|
||||||
|
commandResult << "executed " << ncycles << " cycles";
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// "tia"
|
// "tia"
|
||||||
void DebuggerParser::executeTia()
|
void DebuggerParser::executeTia()
|
||||||
|
@ -2868,6 +2885,16 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
|
||||||
std::mem_fn(&DebuggerParser::executeStep)
|
std::mem_fn(&DebuggerParser::executeStep)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"stepwhile",
|
||||||
|
"Single step CPU while <condition> is true",
|
||||||
|
"Example: stepwhile pc!=$f2a9",
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
{ kARG_WORD, kARG_END_ARGS },
|
||||||
|
std::mem_fn(&DebuggerParser::executeStepwhile)
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"tia",
|
"tia",
|
||||||
"Show TIA state",
|
"Show TIA state",
|
||||||
|
|
|
@ -66,7 +66,7 @@ class DebuggerParser
|
||||||
string saveScriptFile(string file);
|
string saveScriptFile(string file);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum { kNumCommands = 91 };
|
enum { kNumCommands = 92 };
|
||||||
|
|
||||||
// Constants for argument processing
|
// Constants for argument processing
|
||||||
enum {
|
enum {
|
||||||
|
@ -210,6 +210,7 @@ class DebuggerParser
|
||||||
void executeSavestateif();
|
void executeSavestateif();
|
||||||
void executeScanline();
|
void executeScanline();
|
||||||
void executeStep();
|
void executeStep();
|
||||||
|
void executeStepwhile();
|
||||||
void executeTia();
|
void executeTia();
|
||||||
void executeTrace();
|
void executeTrace();
|
||||||
void executeTrap();
|
void executeTrap();
|
||||||
|
|
Loading…
Reference in New Issue