207

I can add a breakpoint in GDB with:

b <filename>:<line no>

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Chris Smith
  • 18,244
  • 13
  • 59
  • 81

5 Answers5

367

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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
twid
  • 6,368
  • 4
  • 32
  • 50
144

Try these (reference):

clear linenum
clear filename:linenum
Eineki
  • 14,773
  • 6
  • 50
  • 59
25

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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
elite21
  • 757
  • 8
  • 9
9

Use:

clear fileName:lineNum   // Removes all breakpoints at the specified line.
delete breakpoint number // Delete one breakpoint whose number is 'number'
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

To delete the breakpoint at the current line you can also run clear without any arguments:

clear

Handy for when you hit something you didn't want to hit.

TODO any way to disable instead of deleting without typing the line number? disable without arguments just disables all breakpoints. I wish I could disable . or something like that.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985