•Enabled once. The breakpoint stops your program, but then becomes disabled.
•Enabled for deletion. The breakpoint stops your program, but immediately after it does so it is deleted permanently. A breakpoint set with the tbreak command starts out in this state.
You can use the following commands to enable or disable breakpoints, watchpoints, and catchpoints:
disable [breakpoints] | Disable the specified breakpoints―or all |
[range...] | breakpoints, if none are listed. A disabled |
| breakpoint has no effect but is not forgotten. All |
| options such as |
| commands are remembered in case the |
| breakpoint is enabled again later. You may |
| abbreviate disable as dis. |
enable [breakpoints] | Enable the specified breakpoints (or all defined |
[range...] | breakpoints). They become effective once again |
| in stopping your program. |
enable [breakpoints] once | Enable the specified breakpoints temporarily. |
range... | GDB disables any of these breakpoints |
| immediately after stopping your program. |
enable [breakpoints] delete | Enable the specified breakpoints to work once, |
range... | then die. GDB deletes any of these breakpoints |
| as soon as your program stops there. |
Except for a breakpoint set with tbreak (see “Setting breakpoints” (page 52)), breakpoints that you set are initially enabled; subsequently, they become disabled or enabled only when you use one of the commands above. (The command until can set and delete a breakpoint of its own, but it does not change the state of your other breakpoints; see “Continuing and stepping” (page 64).)
5.1.5 Break conditionsThe simplest sort of breakpoint breaks every time your program reaches a specified place. You can also specify a condition for a breakpoint. A condition is just a Boolean expression in your programming language (see “Expressions” (page 83)). A breakpoint with a condition evaluates the expression each time your program reaches it, and your program stops only if the condition is true.
This is the converse of using assertions for program validation; in that situation, you want to stop when the assertion is violated―that is, when the condition is false. In C, if you want to test an assertion expressed by the condition assert, you should set the condition '! assert' on the appropriate breakpoint.
Conditions are also accepted for watchpoints; you may not need them, since a watchpoint is inspecting the value of an expression anyhow―but it might be simpler,
5.1 Breakpoints | 59 |