Next: , Previous: , Up: Breakpoints   [Contents][Index]

5.1.4 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.


Delete any breakpoints at the next instruction to be executed in the selected stack frame (see Selecting a Frame). When the innermost frame is selected, this is a good way to delete a breakpoint where your program just stopped.

clear locspec

Delete any breakpoint with a code location that corresponds to locspec. See Location Specifications, for the various forms of locspec. Which code locations correspond to locspec depends on the form used in the location specification locspec:

-line linenum
-source filename -line linenum

If locspec specifies a line number, with or without a file name, the command deletes any breakpoint with a code location that is at or within the specified line linenum in files that match the specified filename. If filename is omitted, it defaults to the current source file.


If locspec specifies an address, the command deletes any breakpoint with a code location that is at the given address.

-function function

If locspec specifies a function, the command deletes any breakpoint with a code location that is at the entry to any function whose name matches function.

Ambiguity in names of files and functions can be resolved as described in Location Specifications.

delete [breakpoints] [list]

Delete the breakpoints, watchpoints, tracepoints, or catchpoints of the breakpoint list specified as argument. If no argument is specified, delete all breakpoints, watchpoints, tracepoints, and catchpoints (GDB asks confirmation, unless you have set confirm off). You can abbreviate this command as d.

Next: , Previous: , Up: Breakpoints   [Contents][Index]