add load and save all states commands to debugger

This commit is contained in:
Thomas Jentzsch 2019-07-26 15:46:24 +02:00
parent d6e2c11275
commit 0112b89666
4 changed files with 60 additions and 6 deletions

View File

@ -262,6 +262,14 @@ void Debugger::saveState(int state)
myOSystem.state().saveState(state);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::saveAllStates()
{
// Saving states is implicitly a read-only operation, so we keep the
// system locked, so no changes can occur
myOSystem.state().rewindManager().saveAllStates();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::loadState(int state)
{
@ -274,6 +282,18 @@ void Debugger::loadState(int state)
lockSystem();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::loadAllStates()
{
// We're loading new states, so we start with a clean slate
mySystem.clearDirtyPages();
// State loading could initiate a bankswitch, so we allow it temporarily
unlockSystem();
myOSystem.state().rewindManager().loadAllStates();
lockSystem();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::step()
{

View File

@ -52,7 +52,6 @@ class RewindManager;
using FunctionMap = std::map<string, unique_ptr<Expression>>;
using FunctionDefMap = std::map<string, string>;
/**
The base dialog for all debugging widgets in Stella. Also acts as the parent
for all debugging operations in Stella (parser, 6502 debugger, etc).
@ -299,7 +298,9 @@ class Debugger : public DialogContainer
void clearAllBreakPoints();
void saveState(int state);
void saveAllStates();
void loadState(int state);
void loadAllStates();
private:
Console& myConsole;

View File

@ -53,7 +53,6 @@ using std::right;
#include "DebuggerParser.hxx"
// TODO - use C++ streams instead of nasty C-strings and pointers
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -324,7 +323,6 @@ string DebuggerParser::showWatches()
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Private methods below
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1482,7 +1480,6 @@ void DebuggerParser::executeListsavestateifs()
commandResult << "no savestateifs defined";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "listtraps"
void DebuggerParser::executeListtraps()
@ -1513,6 +1510,13 @@ void DebuggerParser::executeListtraps()
commandResult << "no traps set";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "loadallstates"
void DebuggerParser::executeLoadallstates()
{
debugger.loadAllStates();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "loadconfig"
void DebuggerParser::executeLoadconfig()
@ -1804,6 +1808,13 @@ void DebuggerParser::executeSavesnap()
debugger.tiaOutput().saveSnapshot(execDepth, execPrefix);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "saveallstates"
void DebuggerParser::executeSaveallstates()
{
debugger.saveAllStates();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "savestate"
void DebuggerParser::executeSavestate()
@ -2702,13 +2713,23 @@ DebuggerParser::Command DebuggerParser::commands[NumCommands] = {
{
"loadconfig",
"Load Distella config file",
"Example: loadconfig file.cfg",
"Example: loadconfig",
false,
true,
{ Parameters::ARG_END_ARGS },
std::mem_fn(&DebuggerParser::executeLoadconfig)
},
{
"loadallstates",
"Load all emulator states",
"Example: loadallstates (no parameters)",
false,
true,
{ Parameters::ARG_END_ARGS },
std::mem_fn(&DebuggerParser::executeLoadallstates)
},
{
"loadstate",
"Load emulator state xx (0-9)",
@ -2936,6 +2957,16 @@ DebuggerParser::Command DebuggerParser::commands[NumCommands] = {
std::mem_fn(&DebuggerParser::executeSavesnap)
},
{
"saveallstates",
"Save all emulator states",
"Example: saveallstates (no parameters)",
false,
false,
{ Parameters::ARG_END_ARGS },
std::mem_fn(&DebuggerParser::executeSaveallstates)
},
{
"savestate",
"Save emulator state xx (valid args 0-9)",

View File

@ -88,7 +88,7 @@ class DebuggerParser
};
// List of commands available
static constexpr uInt32 NumCommands = 92;
static constexpr uInt32 NumCommands = 94;
struct Command {
string cmdString;
string description;
@ -186,6 +186,7 @@ class DebuggerParser
void executeListfunctions();
void executeListsavestateifs();
void executeListtraps();
void executeLoadallstates();
void executeLoadconfig();
void executeLoadstate();
void executeN();
@ -204,6 +205,7 @@ class DebuggerParser
void executeRunToPc();
void executeS();
void executeSave();
void executeSaveallstates();
void executeSaveconfig();
void executeSavedisassembly();
void executeSaverom();