[Converted from Gnats 56] 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. Release: gdb 5.0 Environment: Stock Red Hat Linux 7.1 How-To-Repeat: [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 (gdb)
Fix: 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.
Amazingly, still a bug.
I'm trying to fix this issue. FTR, patch posted here: [v1] https://sourceware.org/pipermail/gdb-patches/2022-March/186607.html [v2] https://sourceware.org/pipermail/gdb-patches/2022-March/186741.html [v3] https://sourceware.org/pipermail/gdb-patches/2022-April/187929.html In addition, many thanks to Tom and Pedro for their patient and help.
Fixed.