This document describes the communication between Debugger (vscode) and Program (compiled FastBasic program). Communication currently uses the H: host drive provided by emulators.
- debug.in - Debugger to Program
- debug.out - Program to Debugger
- debug.mem - Set of memory locations for Program uses to send a "var dump" to the Debugger
- Wait for no existence of outgoing response file
- Check for the existence of the incoming file
- Process incoming file
- Respond as a two step process:
- First, write outgoing response file
- Second, delete incoming file to signal that the outgoing reponse file is ready to be read
Initialize the debugging session and establish breakpoints:
- Debugger injects debugging code to FastBasic source file, and runs FastBasic compile to generate lst,lbl,xex.
- Debugger parses lst/lbl files to read line addresses and build the variable list and variable data request payload
- Debugger retrieves list of breakpoints from vscode and writes "1:Breakpoint List" to program
- Debugger starts emulator to run compiled XEX
- Program processes "1:Continue Execution", and starts Standard Execution
At this point, the debugger waits to hear back from the program to initiate a breakpoint. This is because "1:Continue Execution" will remain until the program deletes it to signal a response (breakpoint hit or end of program).
- Program checks before each line if a breakpoint (or "break on next line" flag) is set. If so:
- Program sends "var dump"
- Debugger parses "var dump", updates variables.
- User can now inspect/change variables, change breakpoints, and initiate a command to turn control back to the Program. An update list of breakpoints and any variables modified by the user is sent with this request.
-
Resume Execution (until next breakpoint)
- Debugger sends "1:Continue Execution"
- Program reads "1:Breakpoint list", clears "break on next line" flag
- Program executes current line, resume standard execution
-
Step Forward One Line (Execute current line, then break on next line)
- Debugger sends "2:Step Forward"
- Program reads "2:Step Forward", sets "break on next line" flag
- Program executes current line, resuming standard execution
The debugger inserts a line to wait for keypress before stopping the program. On key press, the program sends "9:Program ended", and debugger stops debugging.