Commit Graph
32 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Sonnet 5 c32df3d931 Debugger: Route BreakpointSubscriber, DisasmSubscriber, and most of
CPUCoreSubscriber through the CPU thread

Continues the pattern started with SteppingSubscriber: route breakpoint,
disassembly, symbol, and register access through Core_RunOnCPUThread()
instead of touching that state directly from the WebSocket handler thread.

Two intentional exceptions, matching the reasoning already used for
cpu.stepInto's "not currently stepping" branch:
- cpu.stepping's Core_Break() call stays unqueued - it's what makes the CPU
  thread start reaching the queue drain point in the first place.
- cpu.status stays unqueued - it's meant to be a cheap, frequently-pollable
  status check, and its "pc" field is already documented as inaccurate unless
  stepping. Matches how SteppingBroadcaster already reads the same state
  directly from the WebSocket thread.

Where a handler's response doesn't depend on anything the queued lambda
computed (plain add/remove endpoints), moved req.Respond() back out after
the Core_RunOnCPUThread() call for readability - the JSON building and
socket write happen later in Finish() regardless of where Respond() is
called, so there's no thread-safety difference either way, just clarity
about what actually needs to run on the CPU thread.

memory.searchDisasm carries the same caveat flagged for memory.search: its
scan range has no size cap, so if the CPU is stepping, a very large range
will now block the CPU thread's own frame pump for the scan's duration
rather than running unqueued on the WebSocket thread as before. Not fixed
here - noted in a comment at the call site.

Replaced remaining `auto` locals in these three files with concrete types.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hqm11k99viLfbJm2MkH4BH
2026-08-08 11:56:32 +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 c20be71c10 Fix the API for MIPSAssembleOpcode to remove a global 2025-11-03 16:08:07 +01:00
Henrik Rydgård 18ccef1bd4 Just some minor code modernization 2025-08-25 10:45:12 +02:00
Henrik Rydgård 597be1c9bc Stop pretending that DisassemblyManager isn't a singleton - it currently is. 2024-12-12 19:25:04 +01:00
Henrik Rydgård 7992ff4627 Make CBreakpoints an object 2024-11-25 00:22:53 +01:00
Henrik Rydgård cf6d06c56a Start work on imdbg 2024-11-07 11:10:12 +01:00
Unknown W. Brackets 8a74d95eb2 Debugger: Fix format for 32-bit OS. 2023-04-09 12:07:41 -07:00
Unknown W. Brackets f44852bb18 Global: Cleanup virtual/override specifiers.
Also missing virtual destructors, hidden non-overrides, etc.
2022-12-10 21:13:36 -08:00
Unknown W. Brackets ac335ad61a armips: Update to UTF-8/c++17 armips. 2022-09-30 19:48:14 -07:00
Unknown W. Brackets b60217d962 Debugger: Fix doc typo for disasm/assemble names. 2022-09-27 19:02:33 -07:00
Unknown W. Brackets 1233d1d376 Reporting: Disable when debugger methods used.
This won't catch all means of hacking memory, but will catch some.
Trying to reduce noise in reporting from debugging.
2022-07-30 18:21:32 -07:00
Unknown W. Brackets c48a203363 Debugger: Avoid infinite loop in disasm API.
This allows for wrap around, but prevents getting stuck looping in out of
bound addresses.
2021-08-29 11:11:01 -07:00
Unknown W. Brackets 012d47bcbf Debugger: Show string in status bar for li, etc.
This is helpful when stepping through the debugger.  Only shows likely
UTF-8 or similar formatted text, but often names or error messages are.
2021-04-21 23:50:59 -07:00
Unknown W. Brackets 5904900d37 Debugger: Add APIs to set/list/search mem tags. 2021-04-06 12:09:39 -07:00
Unknown W. Brackets a0c1320aec Debugger: Return detail for breakpoints in macros. 2021-04-04 20:24:16 -07:00
Unknown W. Brackets cd6be61d98 Common: Correct some formatting type mismatches. 2021-01-01 15:43:13 -08:00
Henrik Rydgård ff8148dd92 Move native/util, native/data and native/i18 to Common/Data.
Also move colorutil.cpp/h

linking build fix experiment

Delete a bunch of unused CMakeLists.txt files

CMakeLists.txt linking fix

Don't include NativeApp.h from any headers.

Android.mk buildfix

Half of the UWP fix

Buildfix

Minor project file cleanup

Buildfixes

Guess what? More buildfixes!
2020-10-04 07:28:29 +02:00
Henrik Rydgård ed88761ecc Merge ext/native/stringutil.cpp/h into Common/StringUtils.cpp/h. 2020-09-29 15:51:51 +02:00
Unknown W. Brackets 4ce2b64ef7 Debugger: Refactor to allow simpler broadcasting.
It's okay to mix a bit for simple ones, I think.
2018-09-01 10:15:22 -07:00
Unknown W. Brackets 25085fa394 Debugger: Add func name and data symbol to disasm. 2018-06-08 06:59:18 -07:00
Unknown W. Brackets 5670fc03ae Debugger: Add debug interfaces for threads.
This way we can switch context.
2018-06-08 06:59:18 -07:00
Unknown W. Brackets 3193772e78 Debugger: Use a lock for memory reallocs.
Simpler this way, no need to remember to lock memory.
2018-06-08 06:59:18 -07:00
Unknown W. Brackets 8598fc9912 Debugger: Add some missing memory locks.
We can restart memory when loading save states, so we need this even while
we've got startup/shutdown locked.
2018-06-08 06:59:18 -07:00
Unknown W. Brackets b2cc4a0965 Debugger: Add memory breakpoint management. 2018-06-08 06:59:18 -07:00
Unknown W. Brackets 18dcea4cdc Debugger: Disasm search API. 2018-06-08 06:59:18 -07:00
Unknown W. Brackets 65feb5f09c Debugger: Include assembler API. 2018-06-08 06:59:18 -07:00
Unknown W. Brackets fc8ad3b47b json: Optimize writing a bit.
This improves the responsiveness of certain APIs.
2018-06-08 06:59:17 -07:00
Unknown W. Brackets ccea863f00 Debugger: Use fragments for long chunks.
Gets it on the wire faster.  More importantly, this allows us to usually
avoid rampant memory allocation even for large responses.
2018-06-08 06:59:17 -07:00
Unknown W. Brackets 8a0e02e223 Debugger: Prevent crazy disasm range.
Also add some documentation.
2018-06-08 06:59:17 -07:00
Unknown W. Brackets 1c107308cd Debugger: Add additional encoding/symbol info. 2018-06-08 06:59:17 -07:00
Unknown W. Brackets 944948a5f4 Debugger: Initial disasm API. 2018-06-08 06:59:17 -07:00