The debugger
One debugging engine with two front ends: the console debugger (pcpp <file> -d) and the debug adapter (pcpp --dap) the editor runs.
What it debugs
Debugging is for the x86_64-windows-gnu target: -d makes a debug build whatever @optimize says. An exe is debugged on its own, a dll inside the exe that loads it (--host <exe>; the editor remembers the host it was given per dll). The command-line forms and their errors are on Debugging from the command line.
The console debugger runs the engine in pcpp's own process; the debug adapter speaks DAP on stdin / stdout, and the editor's debug host runs it.
Breakpoints and stops
- Every
@breakpointstatement of the program is a breakpoint, placed with the ones you set; a console session starts by saying how many it found (<n> breakpoint(s) from @breakpoint). - A breakpoint on a line with no code (a comment, a routine's header) stops at the next line that has code, and says so:
Breakpoint #<n> at <file>:76 (code at line 78). - A breakpoint in a dll waits until the dll is loaded.
- A console session with no breakpoint at all holds the program at its entry, so you can set one first.
- A stop names its reason (entry, breakpoint, step, pause or an exception:
exception $<code>,first chancewhile a guard may still catch it) with the routine and the line:Stopped (breakpoint) in Square at <file>:61. The end of the program isProgram exited with code <n>. - Continue, step over (the next line), step into, step out and pause (Ctrl+C in the console, F6 in the editor) work on PaskalCPP lines.
Looking at the program
- Variables are shown with PaskalCPP's names and types, by frame:
Params:,Locals:,Globals:, each linename: type = value. The call stack lists PaskalCPP routines with their file and line. p <expr>(a WATCH row or a hover in the editor) prints a name and then its members (.x), elements ([n]) or targets (^).- An own, ref or weak shows the object it holds as its target, as a typed pointer does; a weak whose object is gone shows
expired. - The program's own input and output go to the console the console debugger runs in, or to the editor's TERMINAL tab.
The console debugger's commands
| Command | What it does |
|---|---|
b <file>:<line>, b <line> | set a breakpoint (b <line> in the current file) |
bl | list the breakpoints |
bd <n> | delete breakpoint n |
bc | delete every breakpoint |
c | continue |
n | step over (the next line) |
s | step into |
finish | step out |
bt | the call stack |
f <n> | select frame n (locals and p look at it) |
locals | the variables of the selected frame |
p <expr> | print a name, a member, an element or a target |
src | the source around the selected frame |
threads | the threads |
r | run the program again |
| Ctrl+C | pause the running program |
h | this help |
q | quit (ends the program) |
In the editor, continue, step over, into and out, pause and stop are on the Debug menu: see Menus and keys.