166
votes

I can add a breakpoint in GDB with:

b <filename>:<line no>

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

4
have you tried D <filename>:<lino no> ?Eineki
Unfortunately no: It produces an error: "warning: bad breakpoing number at or near '<file>:<no>'"Chris Smith
@Eineki it's the breakpoint no., not the line no. like : d <filename>:<breakpoint no>.Kevin

4 Answers

137
votes

Try these (reference):

clear linenum
clear filename:linenum
308
votes

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
21
votes

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
5
votes

Use:

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