increase maximum iterations and performance of RunToPC command

This commit is contained in:
thrust26 2020-05-13 13:33:17 +02:00
parent 35a113b628
commit ac41d12664
4 changed files with 25 additions and 12 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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);
}
}