gawk: Breakpoint Control
14.3.1 Control of Breakpoints
-----------------------------
As we saw earlier, the first thing you probably want to do in a
debugging session is to get your breakpoints set up, because your
program will otherwise just run as if it was not under the debugger.
The commands for controlling breakpoints are:
'break' [[FILENAME':']N | FUNCTION] ['"EXPRESSION"']
'b' [[FILENAME':']N | FUNCTION] ['"EXPRESSION"']
Without any argument, set a breakpoint at the next instruction to
be executed in the selected stack frame. Arguments can be one of
the following:
N
Set a breakpoint at line number N in the current source file.
FILENAME':'N
Set a breakpoint at line number N in source file FILENAME.
FUNCTION
Set a breakpoint at entry to (the first instruction of)
function FUNCTION.
Each breakpoint is assigned a number that can be used to delete it
from the breakpoint list using the 'delete' command.
With a breakpoint, you may also supply a condition. This is an
'awk' expression (enclosed in double quotes) that the debugger
evaluates whenever the breakpoint is reached. If the condition is
true, then the debugger stops execution and prompts for a command.
Otherwise, it continues executing the program.
'clear' [[FILENAME':']N | FUNCTION]
Without any argument, delete any breakpoint at the next instruction
to be executed in the selected stack frame. If the program stops
at a breakpoint, this deletes that breakpoint so that the program
does not stop at that location again. Arguments can be one of the
following:
N
Delete breakpoint(s) set at line number N in the current
source file.
FILENAME':'N
Delete breakpoint(s) set at line number N in source file
FILENAME.
FUNCTION
Delete breakpoint(s) set at entry to function FUNCTION.
'condition' N '"EXPRESSION"'
Add a condition to existing breakpoint or watchpoint N. The
condition is an 'awk' expression _enclosed in double quotes_ that
the debugger evaluates whenever the breakpoint or watchpoint is
reached. If the condition is true, then the debugger stops
execution and prompts for a command. Otherwise, the debugger
continues executing the program. If the condition expression is
not specified, any existing condition is removed (i.e., the
breakpoint or watchpoint is made unconditional).
'delete' [N1 N2 ...] [N-M]
'd' [N1 N2 ...] [N-M]
Delete specified breakpoints or a range of breakpoints. Delete all
defined breakpoints if no argument is supplied.
'disable' [N1 N2 ... | N-M]
Disable specified breakpoints or a range of breakpoints. Without
any argument, disable all breakpoints.
'enable' ['del' | 'once'] [N1 N2 ...] [N-M]
'e' ['del' | 'once'] [N1 N2 ...] [N-M]
Enable specified breakpoints or a range of breakpoints. Without
any argument, enable all breakpoints. Optionally, you can specify
how to enable the breakpoints:
'del'
Enable the breakpoints temporarily, then delete each one when
the program stops at it.
'once'
Enable the breakpoints temporarily, then disable each one when
the program stops at it.
'ignore' N COUNT
Ignore breakpoint number N the next COUNT times it is hit.
'tbreak' [[FILENAME':']N | FUNCTION]
't' [[FILENAME':']N | FUNCTION]
Set a temporary breakpoint (enabled for only one stop). The
arguments are the same as for 'break'.