Debugger: Fixed debugger not always pausing correctly when opened

This commit is contained in:
Sour 2022-02-20 12:04:17 -05:00
parent ba0b5a89a5
commit e075347ec3
5 changed files with 9 additions and 6 deletions

View file

@ -99,9 +99,6 @@ Debugger::Debugger(Emulator* emu, IConsole* console)
RefreshCodeCache();
if(_emu->IsPaused()) {
Step(_mainCpuType, 1, StepType::Step);
}
_executionStopped = false;
}
@ -397,6 +394,11 @@ void Debugger::Step(CpuType cpuType, int32_t stepCount, StepType type)
_waitForBreakResume = false;
}
bool Debugger::IsPaused()
{
return _waitForBreakResume;
}
bool Debugger::IsExecutionStopped()
{
return _executionStopped || _emu->IsThreadPaused();

View file

@ -106,6 +106,7 @@ public:
void Run();
void Step(CpuType cpuType, int32_t stepCount, StepType type);
bool IsPaused();
bool IsExecutionStopped();
bool HasBreakRequest();

View file

@ -661,7 +661,7 @@ bool Emulator::IsPaused()
{
shared_ptr<Debugger> debugger = _debugger.lock();
if(debugger) {
return debugger->IsExecutionStopped();
return debugger->IsPaused();
} else {
return _paused;
}

View file

@ -536,7 +536,7 @@ namespace Mesen.Debugger.ViewModels
};
}
private void Step(StepType type, int instructionCount = 1)
public void Step(StepType type, int instructionCount = 1)
{
switch(type) {
case StepType.PpuStep:

View file

@ -76,7 +76,7 @@ namespace Mesen.Debugger.Windows
ScrollToAddress((uint)_scrollToAddress);
} else if(_model.Config.BreakOnOpen) {
if(!EmuApi.IsPaused()) {
EmuApi.Pause();
_model.Step(StepType.Step);
}
}
}