diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index b46570a6a..cdb039491 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -293,9 +293,10 @@ void Debugger::loadAllStates() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int Debugger::step() +int Debugger::step(bool save) { - saveOldState(); + if(save) + saveOldState(); uInt64 startCycle = mySystem.cycles(); @@ -303,7 +304,8 @@ int Debugger::step() myOSystem.console().tia().updateScanlineByStep().flushLineCache(); lockSystem(); - addState("step"); + if(save) + addState("step"); return int(mySystem.cycles() - startCycle); } diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index d063f2e90..6083d556a 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -306,7 +306,7 @@ class Debugger : public DialogContainer */ void setQuitState(); - int step(); + int step(bool save = true); int trace(); void nextScanline(int lines); void nextFrame(int frames); diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index d6be07b68..37632be39 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -1744,7 +1744,7 @@ void DebuggerParser::executeRunTo() bool done = false; do { - debugger.step(); + debugger.step(false); // Update romlist to point to current PC int pcline = cartdbg.addressToLine(debugger.cpuDebug().pc()); @@ -1778,22 +1778,32 @@ void DebuggerParser::executeRunToPc() uInt32 count = 0; bool done = false; + constexpr uInt32 max_iterations = 1000000; + // Create a progress dialog box to show the progress searching through the + // disassembly, since this may be a time-consuming operation + ostringstream buf; + buf << "RunTo PC searching through " << max_iterations << " instructions"; + ProgressDialog progress(debugger.baseDialog(), debugger.lfont(), buf.str()); + progress.setRange(0, max_iterations, 5); + do { - debugger.step(); + debugger.step(false); // Update romlist to point to current PC int pcline = cartdbg.addressToLine(debugger.cpuDebug().pc()); done = (pcline >= 0) && (list[pcline].address == args[0]); - } while(!done && ++count < list.size()); + progress.setProgress(count); + } while(!done && ++count < max_iterations/*list.size()*/); + progress.close(); if(done) commandResult - << "set PC to " << Base::HEX4 << args[0] << " in " - << dec << count << " disassembled instructions"; + << "Set PC to $" << Base::HEX4 << args[0] << " in " + << dec << count << " instructions"; else commandResult - << "PC " << Base::HEX4 << args[0] << " not reached or found in " - << dec << count << " disassembled instructions"; + << "PC $" << Base::HEX4 << args[0] << " not reached or found in " + << dec << count << " instructions"; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/RomWidget.cxx b/src/debugger/gui/RomWidget.cxx index bf459d8f7..010ae5f0b 100644 --- a/src/debugger/gui/RomWidget.cxx +++ b/src/debugger/gui/RomWidget.cxx @@ -200,7 +200,8 @@ void RomWidget::runtoPC(int disasm_line) { ostringstream command; command << "runtopc #" << list[disasm_line].address; - instance().debugger().run(command.str()); + string msg = instance().debugger().run(command.str()); + instance().frameBuffer().showMessage(msg); } }