mirror of
https://github.com/SourMesen/Mesen.git
synced 2025-04-02 10:52:48 -04:00
Debugger: Prevent DebugBreakHelper from interfering with step operations done by the user
This commit is contained in:
parent
baa71141ac
commit
8ad553688a
3 changed files with 19 additions and 5 deletions
|
@ -21,7 +21,7 @@ public:
|
|||
//Only attempt to break if this is done in a thread other than the main emulation thread
|
||||
debugger->PreventResume();
|
||||
if(!debugger->IsExecutionStopped()) {
|
||||
debugger->Step(1);
|
||||
debugger->Break();
|
||||
while(!debugger->IsExecutionStopped()) {}
|
||||
_needResume = true;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public:
|
|||
{
|
||||
if(!_isEmulationThread) {
|
||||
if(_needResume) {
|
||||
_debugger->Run();
|
||||
_debugger->ResumeFromBreak();
|
||||
}
|
||||
_debugger->AllowResume();
|
||||
}
|
||||
|
|
|
@ -589,10 +589,10 @@ bool Debugger::SleepUntilResume()
|
|||
stepCount = _stepCount.load();
|
||||
}
|
||||
|
||||
if(stepCount == 0 && !_stopFlag && _suspendCount == 0) {
|
||||
if((stepCount == 0 || _breakRequested) && !_stopFlag && _suspendCount == 0) {
|
||||
//Break
|
||||
auto lock = _breakLock.AcquireSafe();
|
||||
|
||||
|
||||
if(_preventResume == 0) {
|
||||
SoundMixer::StopAudio();
|
||||
MessageManager::SendNotification(ConsoleNotificationType::CodeBreak);
|
||||
|
@ -604,7 +604,7 @@ bool Debugger::SleepUntilResume()
|
|||
}
|
||||
|
||||
_executionStopped = true;
|
||||
while((stepCount == 0 && !_stopFlag && _suspendCount == 0) || _preventResume > 0) {
|
||||
while(((stepCount == 0 || _breakRequested) && !_stopFlag && _suspendCount == 0) || _preventResume > 0) {
|
||||
std::this_thread::sleep_for(std::chrono::duration<int, std::milli>(10));
|
||||
stepCount = _stepCount.load();
|
||||
}
|
||||
|
@ -665,6 +665,16 @@ void Debugger::SetState(DebugState state)
|
|||
}
|
||||
}
|
||||
|
||||
void Debugger::Break()
|
||||
{
|
||||
_breakRequested = true;
|
||||
}
|
||||
|
||||
void Debugger::ResumeFromBreak()
|
||||
{
|
||||
_breakRequested = false;
|
||||
}
|
||||
|
||||
void Debugger::PpuStep(uint32_t count)
|
||||
{
|
||||
_ppuStepCount = count;
|
||||
|
|
|
@ -104,6 +104,7 @@ private:
|
|||
atomic<uint8_t> _lastInstruction;
|
||||
atomic<bool> _stepOut;
|
||||
atomic<int32_t> _stepOverAddr;
|
||||
atomic<bool> _breakRequested;
|
||||
|
||||
int32_t _ppuViewerScanline;
|
||||
int32_t _ppuViewerCycle;
|
||||
|
@ -160,6 +161,9 @@ public:
|
|||
void Suspend();
|
||||
void Resume();
|
||||
|
||||
void Break();
|
||||
void ResumeFromBreak();
|
||||
|
||||
void PpuStep(uint32_t count = 1);
|
||||
void Step(uint32_t count = 1);
|
||||
void StepCycles(uint32_t cycleCount = 1);
|
||||
|
|
Loading…
Add table
Reference in a new issue