This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/624: temporary breakpoint commands lists not executed
- From: brobecker at gnat dot com
- To: gdb-gnats at sources dot redhat dot com
- Date: 31 Jul 2002 19:28:33 -0000
- Subject: gdb/624: temporary breakpoint commands lists not executed
- Reply-to: brobecker at gnat dot com
>Number: 624
>Category: gdb
>Synopsis: temporary breakpoint commands lists not executed
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jul 31 12:38:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Joel Brobecker
>Release: unknown-1.0
>Organization:
>Environment:
Platform independent bug, reproduced on x86-linux.
GNU gdb 2002-07-27-cvs.
>Description:
Using the small program from gdb.base/commands.exp, the following copy
of a GDB sessions shows that commands associated to temporary
breakpoints are not executed when the breakpoint is hit:
(gdb) tbreak factorial
Breakpoint 1 at 0x8048582: file ./gdb.base/run.c, line 77.
(gdb) commands
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just "end".
>silent
>printf "factorial command-list executed\n"
>cont
>end
(gdb) run 1
Starting program: [...]/gdb.base/commands 1
(gdb)
The backtrace confirms that the program executed up to the factorial
breakpoint, and then stopped.
(gdb) bt
#0 factorial (value=1) at ./gdb.base/run.c:77
#1 0x0804855e in main (argc=2, argv=0xbffffa34, envp=0xbffffa40)
at ./gdb.base/run.c:57
#2 0x4005514f in __libc_start_main () from /lib/libc.so.6
(gdb) p /x $pc
$1 = 0x8048582 <<<--- $pc is equal to bp #1 address
The expected output after the run command was:
(gdb) run 1
Starting program: [...]/gdb.base/commands 1
factorial command-list executed
1
Program exited normally.
(gdb)
The problem is that the breakpoint is deleted very early in the inferior
stop handling, so the rest of the code does not have a chance to see
that there was a temporary breakpoint there with a commands list to
execute. To fix this, it is necessary to delay a bit the deletion of
this breakpoint.
>How-To-Repeat:
>Fix:
I have a fix for this which consists into delaying the deletion of this
breakpoint until the next stop. I will send it to gdb-patches shortly.
>Release-Note:
>Audit-Trail:
>Unformatted: