Fix tiny race in PPU breakpoints (#9731)

If the PPU has just being paused by the debugger, before it entered the breakpoint handler, the PPU would continue onto the next instruction skipping the breakpoint but then being paused on it instead.
This commit is contained in:
Eladash 2021-02-06 23:25:40 +02:00 committed by GitHub
parent 5063eefa96
commit fad89f1c3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 7 deletions

View File

@ -21,7 +21,6 @@
#include "lv2/sys_overlay.h"
#include "lv2/sys_process.h"
#include "lv2/sys_memory.h"
#include "Emu/GDB.h"
#ifdef LLVM_AVAILABLE
#ifdef _MSC_VER
@ -454,12 +453,10 @@ extern void ppu_register_function_at(u32 addr, u32 size, ppu_function_t ptr)
// Breakpoint entry point
static bool ppu_break(ppu_thread& ppu, ppu_opcode_t op)
{
// Pause and wait if necessary
bool status = ppu.state.test_and_set(cpu_flag::dbg_pause);
// Pause
ppu.state += cpu_flag::dbg_pause;
g_fxo->get<gdb_server>()->pause_from(&ppu);
if (!status && ppu.check_state())
if (ppu.check_state())
{
return false;
}