3 Commits
Author SHA1 Message Date
Nunuhara Cabbage 76f7e21c95 Improve stack trace
Stack traces now list addresses in addition to function names.
Additionally, debugger stack traces number each frame, and the numbers
can be used together with the PRINT-LOCALS function to print the values
of local variables for any frame on the stack.
2020-08-10 15:51:33 -07:00
Nunuhara Cabbage 1a0a0e0c12 debugger: breakpoints
This is implemented by inserting special opcodes into the game's code.
When the breakpoint handler is finished, it returns the original opcode
so that execute_instruction can continue executing normally.

E.g.

* start xsystem4 with --debug option to drop into debugger immediately
* run (bp "game_main")
* ^d or \exit to close debugger REPL
* ...drop into a debugger REPL again at the game_main function
2020-08-09 12:41:33 -07:00
Nunuhara Cabbage 1c0869b4fb Add debugger, run REPL on VM_ERROR
If Chibi-Scheme is installed, enable a debugger which can be used to
inspect the state of the VM when an error occurs.

So far only supports printing local/global variables. E.g.

    dbg> (print-variable "g_theSactMenu")
    ...
    dbg> (print-locals)
    ...
2019-12-07 09:24:38 -08:00