[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
14.3.1 Control Of Breakpoints
As we saw above, the first thing you probably want to do in a debugging session is to get your breakpoints set up, since otherwise your program will 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 which 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) thatdgawk
evaluates whenever the breakpoint is reached. If the condition is true, thendgawk
stops execution and prompts for a command. Otherwise,dgawk
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 thatdgawk
evaluates whenever the breakpoint or watchpoint is reached. If the condition is true, thendgawk
stops execution and prompts for a command. Otherwise,dgawk
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. Deletes all defined breakpoints if no argument is supplied.
-
disable
[n1 n2 … | n–m] Disable specified breakpoints or a range of breakpoints. Without any argument, disables 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, enables all breakpoints. Optionally, you can specify how to enable the breakpoint:
-
del
Enable the breakpoint(s) temporarily, then delete it when the program stops at the breakpoint.
-
once
Enable the breakpoint(s) temporarily, then disable it when the program stops at the breakpoint.
-
-
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
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |