Debugger: Stop/halt instructions now only display a message, and only break execution if break on cpu crash option is turned on
This commit is contained in:
parent
a20c27758f
commit
8d1f66b2d3
5 changed files with 8 additions and 23 deletions
15
Core/CPU.cpp
15
Core/CPU.cpp
|
@ -86,7 +86,7 @@ void CPU::Reset(bool softReset, NesModel model)
|
||||||
_spriteDmaOffset = 0;
|
_spriteDmaOffset = 0;
|
||||||
_needHalt = false;
|
_needHalt = false;
|
||||||
_dmcDmaRunning = false;
|
_dmcDmaRunning = false;
|
||||||
_warnOnCrash = true;
|
_lastCrashWarning = 0;
|
||||||
|
|
||||||
//Used by NSF code to disable Frame Counter & DMC interrupts
|
//Used by NSF code to disable Frame Counter & DMC interrupts
|
||||||
_irqMask = 0xFF;
|
_irqMask = 0xFF;
|
||||||
|
@ -293,27 +293,26 @@ uint16_t CPU::FetchOperand()
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(LIBRETRO) && !defined(DUMMYCPU)
|
#if !defined(LIBRETRO) && !defined(DUMMYCPU)
|
||||||
if(_warnOnCrash && _console->GetSettings()->CheckFlag(EmulationFlags::DeveloperMode)) {
|
if(_lastCrashWarning == 0 || _cycleCount - _lastCrashWarning > 5000000) {
|
||||||
MessageManager::DisplayMessage("Error", "GameCrash", "Invalid OP code - CPU crashed.");
|
MessageManager::DisplayMessage("Error", "GameCrash", "Invalid OP code - CPU crashed.");
|
||||||
_warnOnCrash = false;
|
_lastCrashWarning = _cycleCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
_console->BreakIfDebugging();
|
if(_console->GetSettings()->CheckFlag(EmulationFlags::BreakOnCrash)) {
|
||||||
|
//When "Break on Crash" is enabled, open the debugger and break immediately if a crash occurs
|
||||||
|
_console->GetDebugger(true)->BreakImmediately(BreakSource::BreakOnCpuCrash);
|
||||||
|
}
|
||||||
|
|
||||||
if(_console->IsNsf()) {
|
if(_console->IsNsf()) {
|
||||||
//Don't stop emulation on CPU crash when playing NSFs, reset cpu instead
|
//Don't stop emulation on CPU crash when playing NSFs, reset cpu instead
|
||||||
_console->Reset(true);
|
_console->Reset(true);
|
||||||
return 0;
|
return 0;
|
||||||
} else if(!_console->GetDebugger(false) && !_console->GetSettings()->CheckFlag(EmulationFlags::DeveloperMode)) {
|
|
||||||
//Throw an error and stop emulation core (if debugger is not enabled)
|
|
||||||
throw std::runtime_error("Invalid OP code - CPU crashed");
|
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPU::EndCpuCycle(bool forRead)
|
void CPU::EndCpuCycle(bool forRead)
|
||||||
|
|
|
@ -59,7 +59,7 @@ private:
|
||||||
bool _prevRunIrq = false;
|
bool _prevRunIrq = false;
|
||||||
bool _runIrq = false;
|
bool _runIrq = false;
|
||||||
|
|
||||||
bool _warnOnCrash = true;
|
uint64_t _lastCrashWarning = 0;
|
||||||
|
|
||||||
#ifdef DUMMYCPU
|
#ifdef DUMMYCPU
|
||||||
uint32_t _writeCounter = 0;
|
uint32_t _writeCounter = 0;
|
||||||
|
|
|
@ -1071,18 +1071,6 @@ void Console::LoadState(uint8_t *buffer, uint32_t bufferSize)
|
||||||
LoadState(stream);
|
LoadState(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::BreakIfDebugging()
|
|
||||||
{
|
|
||||||
shared_ptr<Debugger> debugger = _debugger;
|
|
||||||
if(debugger) {
|
|
||||||
debugger->BreakImmediately(BreakSource::BreakOnCpuCrash);
|
|
||||||
} else if(_settings->CheckFlag(EmulationFlags::BreakOnCrash)) {
|
|
||||||
//When "Break on Crash" is enabled, open the debugger and break immediately if a crash occurs
|
|
||||||
debugger = GetDebugger(true);
|
|
||||||
debugger->BreakImmediately(BreakSource::BreakOnCpuCrash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<Debugger> Console::GetDebugger(bool autoStart)
|
std::shared_ptr<Debugger> Console::GetDebugger(bool autoStart)
|
||||||
{
|
{
|
||||||
shared_ptr<Debugger> debugger = _debugger;
|
shared_ptr<Debugger> debugger = _debugger;
|
||||||
|
|
|
@ -187,7 +187,6 @@ public:
|
||||||
//Used to resume the emu loop after calling Pause()
|
//Used to resume the emu loop after calling Pause()
|
||||||
void Resume();
|
void Resume();
|
||||||
|
|
||||||
void BreakIfDebugging();
|
|
||||||
shared_ptr<Debugger> GetDebugger(bool autoStart = true);
|
shared_ptr<Debugger> GetDebugger(bool autoStart = true);
|
||||||
void StopDebugger();
|
void StopDebugger();
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ void RecordedRomTest::ValidateFrame(uint16_t* ppuFrameBuffer)
|
||||||
|
|
||||||
if(memcmp(_screenshotHashes.front(), md5Hash, 16) != 0) {
|
if(memcmp(_screenshotHashes.front(), md5Hash, 16) != 0) {
|
||||||
_badFrameCount++;
|
_badFrameCount++;
|
||||||
_console->BreakIfDebugging();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_currentCount == 0 && _repetitionCount.empty()) {
|
if (_currentCount == 0 && _repetitionCount.empty()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue