Skip to content
PaskalCPP
Tools

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 @breakpoint statement 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 chance while a guard may still catch it) with the routine and the line: Stopped (breakpoint) in Square at <file>:61. The end of the program is Program 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 line name: 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

CommandWhat it does
b <file>:<line>, b <line>set a breakpoint (b <line> in the current file)
bllist the breakpoints
bd <n>delete breakpoint n
bcdelete every breakpoint
ccontinue
nstep over (the next line)
sstep into
finishstep out
btthe call stack
f <n>select frame n (locals and p look at it)
localsthe variables of the selected frame
p <expr>print a name, a member, an element or a target
srcthe source around the selected frame
threadsthe threads
rrun the program again
Ctrl+Cpause the running program
hthis help
qquit (ends the program)

In the editor, continue, step over, into and out, pause and stop are on the Debug menu: see Menus and keys.