gdb/56: "clear" command removes internal breakpoints
Sun May 27 23:18:00 GMT 2001

>Number:         56
>Category:       gdb
>Synopsis:       "clear" command removes internal breakpoints
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 27 23:18:00 PDT 2001
>Originator:     Fred Reiss
>Release:        gdb 5.0
Stock Red Hat Linux 7.1
The "clear" command will merrily delete gdb's special
internal breakpoints.

In particular, if the user sets a normal breakpoint at a 
place where gdb also happens to have an internal breakpoint
and types "clear" when gdb hits the normal breakpoint, then
the internal breakpoint goes away, too.
[wuzzy:~] 12) gcc -g hello.c
[wuzzy:~] 13) gdb a.out
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) br main
Breakpoint 1 at 0x8048466: file hello.c, line 4.
(gdb) ru
Starting program: /home/phred/a.out
Breakpoint 1, main (argc=1, argv=0xbffff91c) at hello.c:4
4           printf( "Hello, world!\n" );
(gdb) maintenance info breakpoints
Num Type           Disp Enb Address    What
1   breakpoint     keep y   0x08048466 in main at hello.c:4
        breakpoint already hit 1 time
-2  shlib events   keep y   0x4000e4f0 <_dl_debug_state>
        breakpoint already hit 3 times
-7  longjmp        keep n   0x400116d0 <longjmp>
-8  longjmp        keep n   0x40053444 <__libc_siglongjmp>
-9  longjmp        keep n   0x40053444 <__libc_siglongjmp>
-10 longjmp resume keep n   0x00000000
(gdb) clear *0x4000e4f0
Deleted breakpoint -2
(gdb) clear *0x400116d0
Deleted breakpoint -7
(gdb) clear *0x40053444
Deleted breakpoints -9 -8
The clear_command() function should check whether a 
breakpoint is an internal breakpoint before deleting it.

Someone might want to add a "maintenance clear" command that
can remove internal breakpoints.

More information about the Gdb-prs mailing list