diff --git a/stella/src/debugger/DebuggerParser.cxx b/stella/src/debugger/DebuggerParser.cxx index 940a2af0c..741e8cf4f 100644 --- a/stella/src/debugger/DebuggerParser.cxx +++ b/stella/src/debugger/DebuggerParser.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: DebuggerParser.cxx,v 1.49 2005-07-08 14:36:17 stephena Exp $ +// $Id: DebuggerParser.cxx,v 1.50 2005-07-11 18:56:26 urchlay Exp $ //============================================================================ #include "bspf.hxx" @@ -267,6 +267,14 @@ Command DebuggerParser::commands[] = { &DebuggerParser::executeRun }, + { + "runto", + "Run until first occurrence of string in disassembly", + false, + { kARG_LABEL, kARG_END_ARGS }, + &DebuggerParser::executeRunTo + }, + { "s", "Set Stack Pointer to value xx", @@ -1202,6 +1210,24 @@ void DebuggerParser::executeRun() { commandResult = "exiting debugger"; } +// "runto" +void DebuggerParser::executeRunTo() { + bool done = false; + int cycles = 0, count = 0; + + do { + cycles += debugger->step(); + if(++count % 100 == 0) + debugger->prompt()->putchar('.'); + string next = debugger->disassemble(debugger->cpuDebug().pc(), 1); + done = (next.find(argStrings[0]) != string::npos); + } while(!done); + + commandResult = "executed "; + commandResult += debugger->valueToString(cycles); + commandResult += " cycles"; +} + // "s" void DebuggerParser::executeS() { debugger->cpuDebug().setSP(args[0]); diff --git a/stella/src/debugger/DebuggerParser.hxx b/stella/src/debugger/DebuggerParser.hxx index 9ff81c040..61acb7354 100644 --- a/stella/src/debugger/DebuggerParser.hxx +++ b/stella/src/debugger/DebuggerParser.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: DebuggerParser.hxx,v 1.27 2005-07-03 08:15:31 urchlay Exp $ +// $Id: DebuggerParser.hxx,v 1.28 2005-07-11 18:56:27 urchlay Exp $ //============================================================================ #ifndef DEBUGGER_PARSER_HXX @@ -122,6 +122,7 @@ class DebuggerParser void executeRiot(); void executeRom(); void executeRun(); + void executeRunTo(); void executeS(); void executeSaveses(); void executeSavestate();