mirror of https://github.com/stella-emu/stella.git
fixed #269
This commit is contained in:
parent
0d609f6845
commit
31b459ac84
|
@ -270,7 +270,7 @@ void Debugger::loadState(int state)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
int Debugger::step()
|
int Debugger::step()
|
||||||
{
|
{
|
||||||
mySystem.clearDirtyPages();
|
saveOldState();
|
||||||
|
|
||||||
uInt64 startCycle = mySystem.cycles();
|
uInt64 startCycle = mySystem.cycles();
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ int Debugger::step()
|
||||||
myOSystem.console().tia().updateScanlineByStep().flushLineCache();
|
myOSystem.console().tia().updateScanlineByStep().flushLineCache();
|
||||||
lockBankswitchState();
|
lockBankswitchState();
|
||||||
|
|
||||||
saveOldState("step");
|
addState("step");
|
||||||
return int(mySystem.cycles() - startCycle);
|
return int(mySystem.cycles() - startCycle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ int Debugger::trace()
|
||||||
// 32 is the 6502 JSR instruction:
|
// 32 is the 6502 JSR instruction:
|
||||||
if(mySystem.peek(myCpuDebug->pc()) == 32)
|
if(mySystem.peek(myCpuDebug->pc()) == 32)
|
||||||
{
|
{
|
||||||
mySystem.clearDirtyPages();
|
saveOldState();
|
||||||
|
|
||||||
uInt64 startCycle = mySystem.cycles();
|
uInt64 startCycle = mySystem.cycles();
|
||||||
int targetPC = myCpuDebug->pc() + 3; // return address
|
int targetPC = myCpuDebug->pc() + 3; // return address
|
||||||
|
@ -306,7 +306,7 @@ int Debugger::trace()
|
||||||
myOSystem.console().tia().updateScanlineByTrace(targetPC).flushLineCache();
|
myOSystem.console().tia().updateScanlineByTrace(targetPC).flushLineCache();
|
||||||
lockBankswitchState();
|
lockBankswitchState();
|
||||||
|
|
||||||
saveOldState("trace");
|
addState("trace");
|
||||||
return int(mySystem.cycles() - startCycle);
|
return int(mySystem.cycles() - startCycle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -485,7 +485,7 @@ void Debugger::nextScanline(int lines)
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
buf << "scanline + " << lines;
|
buf << "scanline + " << lines;
|
||||||
|
|
||||||
mySystem.clearDirtyPages();
|
saveOldState();
|
||||||
|
|
||||||
unlockBankswitchState();
|
unlockBankswitchState();
|
||||||
while(lines)
|
while(lines)
|
||||||
|
@ -495,7 +495,7 @@ void Debugger::nextScanline(int lines)
|
||||||
}
|
}
|
||||||
lockBankswitchState();
|
lockBankswitchState();
|
||||||
|
|
||||||
saveOldState(buf.str());
|
addState(buf.str());
|
||||||
myOSystem.console().tia().flushLineCache();
|
myOSystem.console().tia().flushLineCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ void Debugger::nextFrame(int frames)
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
buf << "frame + " << frames;
|
buf << "frame + " << frames;
|
||||||
|
|
||||||
mySystem.clearDirtyPages();
|
saveOldState();
|
||||||
|
|
||||||
unlockBankswitchState();
|
unlockBankswitchState();
|
||||||
while(frames)
|
while(frames)
|
||||||
|
@ -515,7 +515,7 @@ void Debugger::nextFrame(int frames)
|
||||||
}
|
}
|
||||||
lockBankswitchState();
|
lockBankswitchState();
|
||||||
|
|
||||||
saveOldState(buf.str());
|
addState(buf.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -588,20 +588,24 @@ bool Debugger::patchROM(uInt16 addr, uInt8 value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Debugger::saveOldState(string rewindMsg)
|
void Debugger::saveOldState(bool clearDirtyPages)
|
||||||
{
|
{
|
||||||
|
if (clearDirtyPages)
|
||||||
|
mySystem.clearDirtyPages();
|
||||||
|
|
||||||
myCartDebug->saveOldState();
|
myCartDebug->saveOldState();
|
||||||
myCpuDebug->saveOldState();
|
myCpuDebug->saveOldState();
|
||||||
myRiotDebug->saveOldState();
|
myRiotDebug->saveOldState();
|
||||||
myTiaDebug->saveOldState();
|
myTiaDebug->saveOldState();
|
||||||
|
}
|
||||||
|
|
||||||
// Add another rewind level to the Undo list
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
if(rewindMsg != "")
|
void Debugger::addState(string rewindMsg)
|
||||||
{
|
{
|
||||||
|
// Add another rewind level to the Time Machine buffer
|
||||||
RewindManager& r = myOSystem.state().rewindManager();
|
RewindManager& r = myOSystem.state().rewindManager();
|
||||||
r.addState(rewindMsg);
|
r.addState(rewindMsg);
|
||||||
updateRewindbuttons(r);
|
updateRewindbuttons(r);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -612,7 +616,9 @@ void Debugger::setStartState()
|
||||||
|
|
||||||
// Save initial state and add it to the rewind list (except when in currently rewinding)
|
// Save initial state and add it to the rewind list (except when in currently rewinding)
|
||||||
RewindManager& r = myOSystem.state().rewindManager();
|
RewindManager& r = myOSystem.state().rewindManager();
|
||||||
saveOldState(r.atLast() ? "enter debugger" : "");
|
saveOldState(false);
|
||||||
|
if (r.atLast())
|
||||||
|
addState("enter debugger");
|
||||||
|
|
||||||
// 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
|
||||||
myDialog->rom().invalidate(false);
|
myDialog->rom().invalidate(false);
|
||||||
|
|
|
@ -241,12 +241,15 @@ class Debugger : public DialogContainer
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
Save state of each debugger subsystem.
|
Save state of each debugger subsystem and, by default, mark all
|
||||||
|
pages as clean (ie, turn off the dirty flag).
|
||||||
If a message is provided, we assume that a rewind state should
|
|
||||||
be saved with the given message.
|
|
||||||
*/
|
*/
|
||||||
void saveOldState(string rewindMsg = "");
|
void saveOldState(bool clearDirtyPages = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Saves a rewind state with the given message.
|
||||||
|
*/
|
||||||
|
void addState(string rewindMsg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set initial state before entering the debugger.
|
Set initial state before entering the debugger.
|
||||||
|
|
|
@ -233,7 +233,7 @@ bool M6502::execute(uInt32 number)
|
||||||
cond = evalCondSaveStates();
|
cond = evalCondSaveStates();
|
||||||
if(cond > -1)
|
if(cond > -1)
|
||||||
{
|
{
|
||||||
myDebugger->saveOldState("conditional savestate");
|
myDebugger->addState("conditional savestate");
|
||||||
}
|
}
|
||||||
#endif // DEBUGGER_SUPPORT
|
#endif // DEBUGGER_SUPPORT
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue