partially reverted a95d40c6 (debugger widgets needed for saveOldState)

This commit is contained in:
thrust26 2021-01-24 10:09:30 +01:00
parent 08fab4a5bd
commit dcb155a003
3 changed files with 21 additions and 32 deletions

View File

@ -84,6 +84,7 @@ Debugger::Debugger(OSystem& osystem, Console& console)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Debugger::~Debugger() Debugger::~Debugger()
{ {
delete myDialog; myDialog = nullptr;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -99,6 +100,11 @@ void Debugger::initialize()
myOSystem.settings().setValue("dbg.res", mySize); myOSystem.settings().setValue("dbg.res", mySize);
delete myDialog; myDialog = nullptr;
myDialog = new DebuggerDialog(myOSystem, *this, 0, 0, mySize.w, mySize.h);
myCartDebug->setDebugWidget(&(myDialog->cartDebug()));
saveOldState(); saveOldState();
} }
@ -123,8 +129,8 @@ bool Debugger::start(const string& message, int address, bool read,
buf << message; buf << message;
if(address > -1) if(address > -1)
buf << cartDebug().getLabel(address, read, 4); buf << cartDebug().getLabel(address, read, 4);
dialog().message().setText(buf.str()); myDialog->message().setText(buf.str());
dialog().message().setToolTip(toolTip); myDialog->message().setToolTip(toolTip);
return true; return true;
} }
return false; return false;
@ -137,7 +143,7 @@ bool Debugger::startWithFatalError(const string& message)
{ {
// This must be done *after* we enter debug mode, // This must be done *after* we enter debug mode,
// so the dialog is properly shown // so the dialog is properly shown
dialog().showFatalMessage(message); myDialog->showFatalMessage(message);
return true; return true;
} }
return false; return false;
@ -574,8 +580,8 @@ void Debugger::nextFrame(int frames)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::updateRewindbuttons(const RewindManager& r) void Debugger::updateRewindbuttons(const RewindManager& r)
{ {
dialog().rewindButton().setEnabled(!r.atFirst()); myDialog->rewindButton().setEnabled(!r.atFirst());
dialog().unwindButton().setEnabled(!r.atLast()); myDialog->unwindButton().setEnabled(!r.atLast());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -679,13 +685,13 @@ void Debugger::setStartState()
updateRewindbuttons(r); updateRewindbuttons(r);
// Set the 're-disassemble' flag, but don't do it until the next scheduled time // Set the 're-disassemble' flag, but don't do it until the next scheduled time
dialog().rom().invalidate(false); myDialog->rom().invalidate(false);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::setQuitState() void Debugger::setQuitState()
{ {
dialog().saveConfig(); myDialog->saveConfig();
saveOldState(); saveOldState();
// Bus must be unlocked for normal operation when leaving debugger mode // Bus must be unlocked for normal operation when leaving debugger mode
@ -840,18 +846,6 @@ bool Debugger::canExit() const
return baseDialogIsActive(); return baseDialogIsActive();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DebuggerDialog& Debugger::dialog()
{
if(myDialog == nullptr)
{
myDialog = make_unique<DebuggerDialog>(myOSystem, *this, 0, 0, mySize.w, mySize.h);
myCartDebug->setDebugWidget(&(myDialog->cartDebug()));
}
return *myDialog;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
std::array<Debugger::BuiltinFunction, 18> Debugger::ourBuiltinFunctions = { { std::array<Debugger::BuiltinFunction, 18> Debugger::ourBuiltinFunctions = { {
// left joystick: // left joystick:

View File

@ -279,7 +279,7 @@ class Debugger : public DialogContainer
/** /**
Return (and possibly create) the bottom-most dialog of this container. Return (and possibly create) the bottom-most dialog of this container.
*/ */
Dialog* baseDialog() override { return &dialog(); } Dialog* baseDialog() override { return myDialog; }
private: private:
/** /**
@ -332,16 +332,11 @@ class Debugger : public DialogContainer
void loadState(int state); void loadState(int state);
void loadAllStates(); void loadAllStates();
/**
Return (and possibly create) the debugger dialog.
*/
DebuggerDialog& dialog();
private: private:
Console& myConsole; Console& myConsole;
System& mySystem; System& mySystem;
unique_ptr<DebuggerDialog> myDialog; DebuggerDialog* myDialog{nullptr};
unique_ptr<DebuggerParser> myParser; unique_ptr<DebuggerParser> myParser;
unique_ptr<CartDebug> myCartDebug; unique_ptr<CartDebug> myCartDebug;
unique_ptr<CpuDebug> myCpuDebug; unique_ptr<CpuDebug> myCpuDebug;

View File

@ -1251,7 +1251,7 @@ void DebuggerParser::executeDump()
const string outStr = out.str(); const string outStr = out.str();
const string resultStr = commandResult.str(); const string resultStr = commandResult.str();
DebuggerDialog* dlg = &debugger.dialog(); DebuggerDialog* dlg = debugger.myDialog;
BrowserDialog::show(dlg, "Save Dump as", path.str(), BrowserDialog::show(dlg, "Save Dump as", path.str(),
BrowserDialog::Mode::FileSave, BrowserDialog::Mode::FileSave,
[this, dlg, outStr, resultStr] [this, dlg, outStr, resultStr]
@ -1892,7 +1892,7 @@ void DebuggerParser::executeSave()
{ {
if(argCount && argStrings[0] == "?") if(argCount && argStrings[0] == "?")
{ {
DebuggerDialog* dlg = &debugger.dialog(); DebuggerDialog* dlg = debugger.myDialog;
BrowserDialog::show(dlg, "Save Workbench as", BrowserDialog::show(dlg, "Save Workbench as",
dlg->instance().userDir().getPath() + cartName() + ".script", dlg->instance().userDir().getPath() + cartName() + ".script",
@ -1916,7 +1916,7 @@ void DebuggerParser::executeSaveAccess()
{ {
if(argCount && argStrings[0] == "?") if(argCount && argStrings[0] == "?")
{ {
DebuggerDialog* dlg = &debugger.dialog(); DebuggerDialog* dlg = debugger.myDialog;
BrowserDialog::show(dlg, "Save Access Counters as", BrowserDialog::show(dlg, "Save Access Counters as",
dlg->instance().userDir().getPath() + cartName() + ".csv", dlg->instance().userDir().getPath() + cartName() + ".csv",
@ -1947,7 +1947,7 @@ void DebuggerParser::executeSavedisassembly()
{ {
if(argCount && argStrings[0] == "?") if(argCount && argStrings[0] == "?")
{ {
DebuggerDialog* dlg = &debugger.dialog(); DebuggerDialog* dlg = debugger.myDialog;
BrowserDialog::show(dlg, "Save Disassembly as", BrowserDialog::show(dlg, "Save Disassembly as",
dlg->instance().userDir().getPath() + cartName() + ".asm", dlg->instance().userDir().getPath() + cartName() + ".asm",
@ -1971,7 +1971,7 @@ void DebuggerParser::executeSaverom()
{ {
if(argCount && argStrings[0] == "?") if(argCount && argStrings[0] == "?")
{ {
DebuggerDialog* dlg = &debugger.dialog(); DebuggerDialog* dlg = debugger.myDialog;
BrowserDialog::show(dlg, "Save ROM as", BrowserDialog::show(dlg, "Save ROM as",
dlg->instance().userDir().getPath() + cartName() + ".a26", dlg->instance().userDir().getPath() + cartName() + ".a26",
@ -1999,7 +1999,7 @@ void DebuggerParser::executeSaveses()
if(argCount && argStrings[0] == "?") if(argCount && argStrings[0] == "?")
{ {
DebuggerDialog* dlg = &debugger.dialog(); DebuggerDialog* dlg = debugger.myDialog;
BrowserDialog::show(dlg, "Save Session as", BrowserDialog::show(dlg, "Save Session as",
dlg->instance().userDir().getPath() + filename.str(), dlg->instance().userDir().getPath() + filename.str(),