The debugger previously started execution upon receiving a 'launch'
request. This created a race condition where execution could begin
before breakpoints were set by the client.
This change ensures the debugger waits for both 'launch' and
'configurationDone' requests before starting the debugee. This allows
the client to set breakpoints before execution begins.
Previously, the debugger displayed `ref int` variables like this:
ref_int: <unsupported-data-type>
<void>: <unsupported-data-type>
This commit introduces `dbg_variable_to_string()` to dereference these
variables and display their underlying value. Both the command-line and
DAP debugger interfaces have been updated to use this new functionality.
The DAP 'evaluate' request handler now correctly uses the 'frameId'
argument to set the evaluation context.
This also fixes incorrect evaluation of expressions containing non-ASCII
characters.
Debuggers that operate at the instruction level can execute instruction-
level step even when xsystem4 has loaded debug information, by adding
`granularity: "instruction"` to the step request.
- Add support for setBreakpoints request
- Add source locations to stackTrace response
- Source-level stepIn/stepOut/next executions
All of these only work if debug information is available. Otherwise they
work at the instruction level as before.
* Add `allThreadsStopped` to Stopped event to indicate that stacktrace
can be accessed
* StackTraceResponse should return most recent call first
* Fix instruction pointers of calling frames
The first two will improve compatibility with DAP clients other than
xsys4dbg.
xsystem4.scene: returns a list of scene entities
* all entities have an entityId that can be used in further requests
* SACT2 sprites have a 'sprite' member with a spriteId that can be
used in further requests
xsystem4.renderEntity: renders a scene entity and returns the texture
xsystem4.spriteTexture: returns the stored SACT2 sprite texture
xsystem4.renderParts: renders a parts object and returns the texture
xsystem4.partsTexture: returns the stored parts object texture
Image data in texture objects is RGB8888 encoded in base 64.
So far only basic debugging functionality is implemented (breakpoints,
stepping, stack traces/variables).
This is not tested against an established DAP client. My intention is to
create a custom GUI frontend and extend the protocol to support
xsystem4-specific features, such as inspecting the scene. (This work is
underway.)
Instruction references are hex-encoded address strings. Clients do not
need to obtain them from DAP requests. This is outside the spec, but it
is needed for a binary-only debugger.
Functions that write directly to stdout (e.g. printf) should generally
not be used any more. Instead, use either sys_message (which respects
sys_silent) or log_message (which will send the message to the debugger
if DAP is enabled). stderr can be used as normal.