5.1.3 Deleting breakpoints

It is often necessary to eliminate a breakpoint, watchpoint, or catchpoint once it has done its job and you no longer want your program to stop there. This is called deleting the breakpoint. A breakpoint that has been deleted no longer exists; it is forgotten.

With the clear command you can delete breakpoints according to where they are in your program. With the delete command you can delete individual breakpoints, watchpoints, or catchpoints by specifying their breakpoint numbers.

It is not necessary to delete a breakpoint to proceed past it. GDB automatically ignores breakpoints on the first instruction to be executed when you continue execution without changing the execution address.

clear

Delete any breakpoints at the next instruction to

 

be executed in the selected stack frame (see

 

“Selecting a frame” (page 73)). When the

 

innermost frame is selected, this is a good way

 

to delete a breakpoint where your program just

 

stopped.

clear function, clear

Delete any breakpoints set at entry to the function

filename:function

function.

clear linenum, clear

Delete any breakpoints set at or within the code

filename:linenum

of the specified line.

delete [breakpoints]

Delete the breakpoints, watchpoints, or

[range...]

catchpoints of the breakpoint ranges specified as

 

arguments. If no argument is specified, delete all

 

breakpoints (GDB asks confirmation, unless you

 

have set confirm off). You can abbreviate

 

this command as d.

5.1.4 Disabling breakpoints

Rather than deleting a breakpoint, watchpoint, or catchpoint, you might prefer to disable it. This makes the breakpoint inoperative as if it had been deleted, but remembers the information on the breakpoint so that you can enable it again later.

You disable and enable breakpoints, watchpoints, and catchpoints with the enable and disable commands, optionally specifying one or more breakpoint numbers as arguments. Use info break or info watch to print a list of breakpoints, watchpoints, and catchpoints if you do not know which numbers to use.

A breakpoint, watchpoint, or catchpoint can have any of four different states of enablement:

Enabled. The breakpoint stops your program. A breakpoint set with the break command starts out in this state.

Disabled. The breakpoint has no effect on your program.

58 Stopping and Continuing

Page 58
Image 58
HP gnu source-level debugger 5992-4701 manual Deleting breakpoints, Disabling breakpoints, Selecting a frame page 73 . When