Commit Graph
267 Commits
Author SHA1 Message Date
Henrik Rydgård 2d0e54f422 Headless (and main): Improve crash reporting 2026-08-11 22:36:47 +02:00
Henrik Rydgård 6a873df4ea Work on improving crash log output 2026-08-11 22:36:47 +02:00
Henrik Rydgård ebc151f8f2 Warning fixes 2026-08-11 22:36:47 +02:00
Henrik Rydgård 04ef18a9d9 Send the crash dump output to the debug output stream in headless. This makes it so that crash-failed test output will contain crash details.
Also fix some warnings and stuff.
2026-08-11 22:36:47 +02:00
Henrik Rydgård a44c2c0bde Replace System_SendDebugOutput with a registered callback
I normally try to avoid registrations when not needed, but in this case
only headless uses this, so it's motivated.
2026-08-11 22:36:47 +02:00
Henrik Rydgård 2d208ca7d9 Remove Read_U32 from sceKernelMutex 2026-08-10 11:02:25 +02:00
Henrik Rydgård b42157aa49 Core: Add utility function to properly report memory exceptions from HLE functions (when they would actually crash the PSP) 2026-08-10 10:41:32 +02:00
Henrik RydgårdandClaude Sonnet 5 5df8c14f1e Core_RunOnCPUThread: drain the queue from NativeFrame(), not just Core_RunLoopUntil()
Core_RunLoopUntil() is only reached while a game is actually loaded and
running (via EmuScreen). Anything calling Core_RunOnCPUThread() while at
the main menu with no game loaded would hang forever waiting for a queue
that was never drained. Call Core_ProcessCPUQueue() directly from
NativeFrame(), just before screenManager->render(), so it always runs;
Core_RunLoopUntil() still also drains it for the tight-spin-while-stepping
case once a game is running.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hqm11k99viLfbJm2MkH4BH
2026-08-08 17:22:12 +02:00
Henrik RydgårdandClaude Sonnet 5 f72709feb0 Legacy Win32 debugger: fix the painting problem with a frame-scoped mutex
Debugger windows (register list, disassembly view, memory view, breakpoint/
thread/module/stack lists, watch list) read CPU-thread-owned state directly
from the GUI thread's WM_PAINT/list-fill handlers, racing against the CPU
thread. Routing every read through Core_RunOnCPUThread would be too slow for
something invoked continuously on paint/list-refresh.

Add g_frameMutex (Core.h/Core.cpp), held by NativeFrame() only across the
span where it actually touches that state (running the CPU, processing
breakpoints, running the ImGui debugger) - not across input handling or the
present/frame-pacing waits. Debugger windows now hold the same mutex while
reading, giving synchronized reads without the round-trip cost of queuing
to the CPU thread.

CtrlRegisterList::onPaint() goes back to always reading live values (now
safe under the lock) and grays them out by color alone while the core is
running, rather than the earlier snapshot-caching approach.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hqm11k99viLfbJm2MkH4BH
2026-08-08 17:22:12 +02:00
Henrik RydgårdandClaude Sonnet 5 c6fccefa49 Debugger: Route cpu.stepInto's stepping state through the CPU thread
The WebSocket debugger's cpu.stepInto handler ran entirely on the WebSocket
handler thread, directly manipulating breakpoints and stepping state (via
Core_RequestCPUStep, g_breakpoints.SetSkipFirst, etc.) that's otherwise only
ever touched from the CPU thread (the one that calls Core_RunLoopUntil, and
thus indirectly NativeFrame).

Adds Core_RunOnCPUThread() - queues a function to run on the CPU thread and
blocks the caller until it's done. The queue is drained at the top of
Core_RunLoopUntil()'s loop, so it's reached continuously (in a tight spin)
while the CPU is stepping/paused, and at least once per call even while fully
running.

cpu.stepInto is the first consumer: once the CPU is already stepping, the
breakpoint/stepping manipulation is now routed through Core_RunOnCPUThread
instead of happening directly on the WebSocket thread. The "not currently
stepping" path still calls Core_Break() directly from the WebSocket thread,
since it's already documented free-threaded and is what makes the CPU thread
start reaching the queue-drain point in the first place.

More WebSocket debugger commands can be converted the same way going forward.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hqm11k99viLfbJm2MkH4BH
2026-08-08 11:21:46 +02:00
Henrik RydgårdandClaude Sonnet 5 b1f0112cef Debugger: Remove opcode-fusion display and fix cpu step size units
DisassemblyManager used to fuse lui+addiu/load/store into single pseudo-
instructions ("li", fused loads/stores) for display. This only applied to a
handful of opcodes, complicated DisassemblyManager, and was the root cause of
a stepping bug: Core_PerformCPUStep's Into/Over cases treated stepSize as a
byte count, while the WebSocket cpu.stepInto handler computed it as an
instruction count (needed to step over a whole fused macro in one go) - so a
plain, non-fused stepInto silently executed zero instructions.

Removed the fusion logic entirely (DisassemblyMacro, DISTYPE_MACRO) - every
disassembly line is now exactly one 4-byte instruction. With that,
"how many instructions does this line span" is always 1, so the
getInstructionSizeAt() byte-size queries in the legacy Windows and ImGui
debuggers are gone too; step requests just pass 1. Core_RequestCPUStep's
stepSize is now consistently in instructions everywhere.

Also fixes the PPSSPPHeadless build, broken since 0ed1f3e added
OpenWebDebugger() (which calls System_LaunchUrl) without a headless stub.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hqm11k99viLfbJm2MkH4BH
2026-08-08 11:16:36 +02:00
Henrik Rydgård 39c8cbbde1 Use the new kernel module description thing to annotate GPRs in the register viewer 2026-07-28 00:15:41 +02:00
Henrik RydgårdandClaude Opus 5 9b577b5f46 Show module.section+offset next to addresses in exception/stack-trace logs
Added KernelModuleAddressDescription() (Core/HLE/sceKernelModule.cpp),
which looks up which currently loaded module (and text/data/bss/segment
section within it) an address falls in, e.g. "EBOOT.BIN.text+1234".
Wired it into:

- Core_MemoryException/Core_ExecException/Core_BreakException
  (Core/Core.cpp), appended next to every address/pc/ra shown in their
  log lines.
- FormatStackTrace (Core/MemFault.cpp), appended per-frame next to the
  existing symbol description.

This makes crash/exception logs actionable even when there's no symbol
at the faulting address - you at least get which module and section
it's in, useful for reverse engineering unfamiliar code.

Verified live via headless: injected a MIPS break instruction at the
current PC (through Tools/wsdbg) and confirmed the log line changed from
"break instruction hit at 088040ac" to "break instruction hit at 088040ac
[sceDisplayWaitVblank Test.text+ac]".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDNwPPuidmNxQGRJxBuRL6
2026-07-27 23:44:14 +02:00
Henrik Rydgård 3139d7ccfe Add command line parameters for controlling the behavior on memory/instruction exceptions 2026-07-27 18:37:26 +02:00
Henrik Rydgård 4bf36fc7f8 Add command line option --vsh to try to boot the VSH. Logspam reduction, improve printf logs. 2026-07-27 14:58:59 +02:00
Henrik Rydgård 3eb056ad86 Move Common/GraphicsContext.h to Common/GPU/GraphicsContext.h 2026-07-26 13:58:17 +02:00
Henrik Rydgård 59637a331d Remove UB in Core_SteppingReason. README update. 2026-05-11 16:20:32 +02:00
Silvris 15189e99d3 time out InactiveCond's wait instead 2025-09-21 21:46:40 -05:00
Silvris 6d5bf32796 initial tests 2025-09-19 02:40:13 -05:00
Henrik Rydgård 93638c8826 Test fix 2025-08-24 15:46:35 +02:00
Henrik Rydgård a107d75e38 Fix lifecycle-notification assert problem (was called from wrong thread) 2025-08-24 11:17:19 +02:00
Henrik Rydgård 1f09b782d7 Make Persona 2 battle transition more reliable. 2025-06-12 11:02:37 +02:00
Henrik Rydgård f9c0c41074 Fix flickering UI state while debugging, breaking the Win32 debugger 2025-06-12 10:20:25 +02:00
Henrik Rydgård 4d7dce4e19 Logging improvement in Core_Break 2025-06-02 00:02:21 +02:00
Henrik Rydgård b27a022e7c Remove two states from the CoreState enum. 2025-04-05 09:18:56 +02:00
Henrik Rydgård 24b30cc709 Mostly remove coreState management from System.cpp 2025-04-05 09:18:56 +02:00
Henrik Rydgård b24ce4bd14 Simplifications 2025-04-05 09:18:56 +02:00
Henrik Rydgård d11f8609ea Add an easy way to break into the imdebugger from assert messageboxs ("No") 2025-03-19 14:22:02 +01:00
Henrik Rydgård 4989ec61d9 BreakpointManager: Safer and simpler updates. 2025-03-03 13:59:42 +01:00
Henrik Rydgård 0a641e1b36 Assorted warning fixes, fix regression on Mac (save/load dialogs) 2025-02-20 15:47:06 -06:00
Henrik Rydgård 31cf5771f4 Turn the break reason into an enum, fix some minor issues 2025-02-19 16:01:11 -06:00
Henrik Rydgård 85c015efb8 Remove redundant shutdown callback 2025-02-13 15:13:25 -06:00
Henrik Rydgård 1ca63161b3 More minor fixes 2025-02-04 10:19:34 -06:00
Henrik Rydgård 63a41e7635 Windows: Fix mis-interaction between no-menu pause and pause on window lost focus, reported by IRVN 2025-01-23 14:32:38 +01:00
Henrik Rydgård 45cf6d423e Buildfixes 2024-12-18 13:57:29 +01:00
Henrik Rydgård 3e198c53b2 More include cleanup 2024-12-18 13:57:26 +01:00
Henrik Rydgård e567a58684 Remove StdioListener 2024-12-16 12:33:58 +01:00
Henrik Rydgård 638607d29a Refactor: Make GPUCommon own the framedump "recorder". 2024-12-15 12:07:44 +01:00
Henrik Rydgård 6baaa2607a GE debugger: Cleaner resume from steps. Fixes GE debugging in God of War. 2024-12-13 20:36:31 +01:00
Henrik Rydgård 4a8a87764c Remove unused state 2024-12-13 19:15:33 +01:00
Henrik Rydgård cccdfad0ba Show basic framebuffer preview 2024-12-10 21:50:14 +01:00
Henrik Rydgård 419c329b06 Show active compat flags on crash screen 2024-12-10 01:43:44 +01:00
Henrik Rydgård b2a8b4168b Core: Minor changes to stepping (and some log changes) 2024-12-10 01:06:19 +01:00
Henrik Rydgård c842e3f137 Fix discrepancy between stepping and running across frame endings. Add some more menu options in the ImDebugger 2024-12-10 01:06:04 +01:00
Henrik Rydgård 93baf22369 ImDebugger: Add frame-stepping and a "skim" button (single-steps while held down) 2024-12-08 15:12:13 +01:00
Henrik Rydgård f74e7fb6f5 Fix running when pc is at breakpoint. Fix issue when stepping through Ge-enqueuing functions. 2024-12-08 15:00:11 +01:00
Henrik Rydgård 080798b5dd Move out two more functions from Core.cpp. Clean up Windows includes 2024-12-08 12:12:02 +01:00
Henrik Rydgård 83af54950f Move more core-related stuff into Core.cpp/h 2024-12-08 11:54:58 +01:00
Henrik Rydgård df91f699fc Move the core loop to Core.cpp 2024-12-08 11:47:12 +01:00
Henrik Rydgård 6adf8cabae Fix regression in break-on-load functionality 2024-12-06 00:40:21 +01:00