How do I remove a single breakpoint with GDB?

Gdb

Gdb Problem Overview


I can add a breakpoint in GDB with:

b <filename>:<line no>

How can I remove an existing breakpoint at a particular location?

Gdb Solutions


Solution 1 - Gdb

You can list breakpoints with:

info break

This will list all breakpoints. Then a breakpoint can be deleted by its corresponding number:

del 3

For example:

 (gdb) info b
 Num     Type           Disp Enb Address    What
  3      breakpoint     keep y   0x004018c3 in timeCorrect at my3.c:215
  4      breakpoint     keep y   0x004295b0 in avi_write_packet atlibavformat/avienc.c:513
 (gdb) del 3
 (gdb) info b
 Num     Type           Disp Enb Address    What
  4      breakpoint     keep y   0x004295b0 in avi_write_packet atlibavformat/avienc.c:513

Solution 2 - Gdb

Try these (reference):

clear linenum
clear filename:linenum

Solution 3 - Gdb

You can delete all breakpoints using

del <start_breakpoint_num> - <end_breakpoint_num>

To view the start_breakpoint_num and end_breakpoint_num use:

info break

Solution 4 - Gdb

Use:

clear fileName:lineNum   // Removes all breakpoints at the specified line.
delete breakpoint number // Delete one breakpoint whose number is 'number'

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionChris SmithView Question on Stackoverflow
Solution 1 - GdbtwidView Answer on Stackoverflow
Solution 2 - GdbEinekiView Answer on Stackoverflow
Solution 3 - Gdbelite21View Answer on Stackoverflow
Solution 4 - Gdbuser3174512View Answer on Stackoverflow