mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-03 03:03:50 +01:00
Move the temporary breakpoint out of the user's breakpoint list
step-over, step-out and run-until plant a one-shot breakpoint at the address they want execution to return to. Keeping it in breakPoints_ alongside the user's own meant the two kept colliding: - Adding a log-only user breakpoint at the same address hijacked the temporary one. AddBreakPoint() didn't match across temp-ness so both existed, and then ChangeBreakPoint() looked up "the first enabled breakpoint at this address" - a log-only breakpoint isn't enabled, so the temporary one won and had its action overwritten to log-only. It lost PAUSE and the step never came back. - RemoveBreakPoint() erased up to two entries per address to catch an overlapping temporary one, so deleting either deleted both - including the interpreter's cleanup path in CheckExecBreakpoints() taking the user's breakpoint with it. - ExecBreakPoint() handled one breakpoint per address, so with both at the same address only one of them did anything: the step completed but the user's log line never printed. - Nothing dropped it when something *else* stopped us first, so an interrupted step left a breakpoint armed at an address nobody was waiting for anymore, which later fired as a phantom stop. It's a single TempBreakPoint member now, invisible to the breakpoint lists and untouched by user edits. One is enough: step over/out and cross-thread step into all require the CPU to already be stepping and resume it immediately, so only one can be in flight, and run-until now replaces rather than stacking (two pending run-untils had no coherent meaning, and the loser stayed armed). Behavior follows what other debuggers do. Both breakpoints at an address are evaluated independently and their actions combine, so a log-only breakpoint logs without stopping and still lets the step finish. Core_Break() drops the temporary breakpoint on any stop, whatever the reason - the same way gdb deletes its step-resume breakpoint and lldb discards the thread plan. Two things to be careful of, both covered by the new TempBreakpoints test: HasBreakPoints() has to account for it, or the interpreter's checked run loop and the JIT skip breakpoint checking entirely and a step with no user breakpoints set never returns; and IsAddressBreakPoint() (user-facing, for the lists and disassembly markers) is now separate from NeedsBreakCheckAt() (what the JIT frontends and interpreter ask), since only the latter should see it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GZq8ZtJmFY7bkX5FVkr3P9
This commit is contained in:
1 parent
0c510ca62e
commit
35a91b757a
16 files changed
+258
-119
No files matched your search
+9
-3
@@ -428,8 +428,7 @@ static void Core_PerformCPUStep(MIPSDebugInterface *cpu, CPUStepType stepType) {
|
||||
breakpointAddress = currentPc + 2 * cpu->getInstructionSize(0);
|
||||
}
|
||||
}
|
||||
// Add a temporary breakpoint.
|
||||
g_breakpoints.AddBreakPoint(breakpointAddress, true);
|
||||
g_breakpoints.SetTempBreakPoint(breakpointAddress);
|
||||
Core_Resume();
|
||||
} else {
|
||||
// If not a branch, just do a simple single-step, no point in involving the breakpoint machinery.
|
||||
@@ -459,7 +458,7 @@ static void Core_PerformCPUStep(MIPSDebugInterface *cpu, CPUStepType stepType) {
|
||||
|
||||
u32 breakpointAddress = frames[1].pc;
|
||||
|
||||
g_breakpoints.AddBreakPoint(breakpointAddress, true);
|
||||
g_breakpoints.SetTempBreakPoint(breakpointAddress);
|
||||
Core_Resume();
|
||||
break;
|
||||
}
|
||||
@@ -568,6 +567,13 @@ void Core_Break(BreakReason reason, u32 relatedAddress) {
|
||||
// Stop the tracer
|
||||
mipsTracer.stop_tracing();
|
||||
|
||||
// Execution stopped, so whatever step-over/step-out/run-until was in flight is over - either
|
||||
// it just completed, or something else (a breakpoint, a memcheck, the user hitting pause)
|
||||
// got there first. Either way its one-shot breakpoint must not stay armed, or it'd fire
|
||||
// later at an address nobody is waiting for anymore. Same as gdb dropping its step-resume
|
||||
// breakpoint, or lldb discarding the thread plan, on any stop.
|
||||
g_breakpoints.ClearTempBreakPoint();
|
||||
|
||||
g_breakReason = reason;
|
||||
g_cpuStepCommand.type = CPUStepType::None;
|
||||
g_cpuStepCommand.reason = reason;
|
||||
|
||||
Reference in new issue
Block a user