double rewind in debugger fixed

rewind messages improved
This commit is contained in:
thrust26 2017-12-12 18:47:21 +01:00
parent fc01aef34e
commit 6632b97307
4 changed files with 21 additions and 35 deletions

View File

@ -134,13 +134,15 @@ bool RewindManager::rewindState()
{
if(!atFirst())
{
RewindState& lastState = myStateList.current();
// Set internal current iterator to previous state (back in time),
// since we will now processed this state
myStateList.moveToPrevious();
RewindState& state = myStateList.current();
Serializer& s = state.data;
string message = getMessage(state);
string message = getMessage(state, lastState);
cerr << "rewind " << state.count << endl;
s.rewind(); // rewind Serializer internal buffers
@ -166,7 +168,7 @@ bool RewindManager::unwindState()
RewindState& state = myStateList.current();
Serializer& s = state.data;
string message = getMessage(state);
string message = getMessage(state, state);
cerr << "unwind " << state.count << endl;
s.rewind(); // rewind Serializer internal buffers
@ -232,7 +234,7 @@ cerr << "remove " << removeIdx << endl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string RewindManager::getMessage(RewindState& state)
string RewindManager::getMessage(RewindState& state, RewindState& lastState)
{
Int64 diff = myOSystem.console().tia().cycles() - state.cycle;
stringstream message;
@ -240,8 +242,8 @@ string RewindManager::getMessage(RewindState& state)
message << (diff >= 0 ? "Rewind" : "Unwind") << " " << getUnitString(diff);
// add optional message (TODO: when smart removal works, we have to do something smart with this part too)
if(!state.message.empty())
message << " (" << state.message << ")";
if(!lastState.message.empty())
message << " (" << lastState.message << ")";
return message.str();
}

View File

@ -167,7 +167,7 @@ class RewindManager
void compressStates();
string getMessage(RewindState& state);
string getMessage(RewindState& state, RewindState& lastState);
private:
// Following constructors and assignment operators not supported

View File

@ -270,7 +270,6 @@ void Debugger::loadState(int state)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::step()
{
saveOldState("1 step");
mySystem.clearDirtyPages();
uInt64 startCycle = mySystem.cycles();
@ -279,6 +278,7 @@ int Debugger::step()
myOSystem.console().tia().updateScanlineByStep().flushLineCache();
lockBankswitchState();
saveOldState("step");
return int(mySystem.cycles() - startCycle);
}
@ -297,7 +297,6 @@ int Debugger::trace()
// 32 is the 6502 JSR instruction:
if(mySystem.peek(myCpuDebug->pc()) == 32)
{
saveOldState("1 trace");
mySystem.clearDirtyPages();
uInt64 startCycle = mySystem.cycles();
@ -307,6 +306,7 @@ int Debugger::trace()
myOSystem.console().tia().updateScanlineByTrace(targetPC).flushLineCache();
lockBankswitchState();
saveOldState("trace");
return int(mySystem.cycles() - startCycle);
}
else
@ -483,11 +483,8 @@ uInt32 Debugger::getBaseAddress(uInt32 addr, bool read)
void Debugger::nextScanline(int lines)
{
ostringstream buf;
buf << lines << " scanline";
if(lines > 1)
buf << "s";
buf << "scanline + " << lines;
saveOldState(buf.str());
mySystem.clearDirtyPages();
unlockBankswitchState();
@ -498,6 +495,7 @@ void Debugger::nextScanline(int lines)
}
lockBankswitchState();
saveOldState(buf.str());
myOSystem.console().tia().flushLineCache();
}
@ -505,11 +503,8 @@ void Debugger::nextScanline(int lines)
void Debugger::nextFrame(int frames)
{
ostringstream buf;
buf << frames << " frame";
if(frames > 1)
buf << "s";
buf << "frame + " << frames;
saveOldState(buf.str());
mySystem.clearDirtyPages();
unlockBankswitchState();
@ -519,6 +514,8 @@ void Debugger::nextFrame(int frames)
--frames;
}
lockBankswitchState();
saveOldState(buf.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -618,11 +615,8 @@ void Debugger::setStartState()
// Lock the bus each time the debugger is entered, so we don't disturb anything
lockBankswitchState();
RewindManager& r = myOSystem.state().rewindManager();
updateRewindbuttons(r);
// Save initial state, but don't add it to the rewind list
saveOldState();
// Save initial state and add it to the rewind list
saveOldState("enter debugger");
// Set the 're-disassemble' flag, but don't do it until the next scheduled time
myDialog->rom().invalidate(false);
@ -634,9 +628,6 @@ void Debugger::setQuitState()
// Bus must be unlocked for normal operation when leaving debugger mode
unlockBankswitchState();
// Save state when leaving the debugger
saveOldState("exit debugger");
// execute one instruction on quit. If we're
// sitting at a breakpoint/trap, this will get us past it.
// Somehow this feels like a hack to me, but I don't know why

View File

@ -143,7 +143,6 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
}
ypos += lineHeight + VGAP;
// How to handle undriven TIA pins
myUndrivenPinsWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"Drive unused TIA pins randomly on a read/peek");
@ -214,9 +213,6 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
wid.push_back(myDebugColorsWidget);
ypos += lineHeight + VGAP + 2;
//StaticTextWidget* s = new StaticTextWidget(myTab, font, HBORDER, ypos, "Debug Colors ");
//ypos += lineHeight + VGAP;
items.clear();
VarList::push_back(items, "Red", "r");
VarList::push_back(items, "Orange", "o");
@ -521,8 +517,6 @@ void DeveloperDialog::loadSettings(SettingsSet set)
myContinuousRewind[set] = instance().settings().getBool(prefix + "rewind");
myStateSize[set] = instance().settings().getInt(prefix + "rewind.size");
myUncompressed[set] = instance().settings().getInt(prefix + "rewind.uncompressed");
/*myStateInterval[set] = instance().settings().getInt(prefix + "rewind.interval");
myStateHorizon[set] = instance().settings().getInt(prefix + "rewind.horizon");*/
myStateInterval[set] = instance().settings().getString(prefix + "rewind.interval");
myStateHorizon[set] = instance().settings().getString(prefix + "rewind.horizon");
@ -631,9 +625,7 @@ void DeveloperDialog::setWidgetStates(SettingsSet set)
myContinuousRewindWidget->setState(myContinuousRewind[set]);
myStateSizeWidget->setValue(myStateSize[set]);
myUncompressedWidget->setValue(myUncompressed[set]);
//myStateIntervalWidget->setSelectedIndex(myStateInterval[set]);
myStateIntervalWidget->setSelected(myStateInterval[set]);
//myStateHorizonWidget->setSelectedIndex(myStateHorizon[set]);
myStateHorizonWidget->setSelected(myStateHorizon[set]);
handleRewind();
@ -726,16 +718,14 @@ void DeveloperDialog::saveConfig()
instance().state().setRewindMode(myContinuousRewindWidget->getState() ?
StateManager::Mode::Rewind : StateManager::Mode::Off);
#ifdef DEBUGGER_SUPPORT
// Debugger font style
instance().settings().setValue("dbg.fontstyle",
myDebuggerFontStyle->getSelectedTag().toString());
#ifdef DEBUGGER_SUPPORT
// Debugger size
instance().settings().setValue("dbg.res",
GUI::Size(myDebuggerWidthSlider->getValue(),
myDebuggerHeightSlider->getValue()));
// Debugger font size
instance().settings().setValue("dbg.fontsize", myDebuggerFontSize->getSelectedTag().toString());
#endif
@ -982,6 +972,7 @@ void DeveloperDialog::handleSize()
bool found = false;
Int32 i;
// handle illegal values
if(interval == -1)
interval = 0;
if(horizon == -1)
@ -1032,6 +1023,7 @@ void DeveloperDialog::handleInterval()
bool found = false;
Int32 i;
// handle illegal values
if(interval == -1)
interval = 0;
if(horizon == -1)
@ -1069,6 +1061,7 @@ void DeveloperDialog::handleHorizon()
bool found = false;
Int32 i;
// handle illegal values
if(interval == -1)
interval = 0;
if(horizon == -1)