This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
hook-stop sees dummy frames, bug or feature?
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb at sourceware dot org
- Cc: vargaz at gmail dot com
- Date: Thu, 22 Jan 2009 03:23:18 +0000
- Subject: hook-stop sees dummy frames, bug or feature?
I was looking at fixing PR9664 <http://sourceware.org/bugzilla/show_bug.cgi?id=9664>,
which was a regression I introduced here:
http://sourceware.org/ml/gdb-patches/2008-09/msg00193.html
The regression is about the fact that the hook-stop in normal_stop
is now run after frame printing, while it is documented as being run before.
"(@samp{hook-stop}) makes the associated commands execute every time
execution stops in your program: before breakpoint commands are run,
displays are printed, or the stack frame is printed."
The current sequence is roughtly:
normal_stop ()
{
...
- print frame
- save `return' or infcall registers
- pop dummy frame
- hook-stop
...
}
Clearly, I need to put running the hook-stop higher up again.
In gdb <= 6.8, the hook-stop was run before we poped off the dummy
frame:
normal_stop ()
{
...
- hook-stop
- print frame
- save `return' or infcall registers
- pop dummy frame
...
}
The case I'm considering is this:
(basically:
define hook-stop
frame
end
p func()
)
>gdb-6.8 ./gdb
(top-gdb) start
Starting program: /home/pedro/gdb/normal_stop/build/gdb/gdb
main (argc=1, argv=0x7ffff00043f8) at ../../src/gdb/gdb.c:28
28 memset (&args, 0, sizeof args);
(top-gdb) define hook-stop
Type commands for definition of "hook-stop".
End with a line saying just "end".
>frame
>end
(top-gdb) p malloc (0)
#0 <function called from gdb> <<<<<< "frame" in hook-stop
Current language: auto; currently asm
$1 = 11407376 <<<<<< 'malloc (0)' result
Current language: auto; currently c
(top-gdb) frame <<<<<< "frame" again shows something else.
#0 main (argc=1, argv=0x7ffff00043f8) at ../../src/gdb/gdb.c:28
28 memset (&args, 0, sizeof args);
Is the fact that the dummy frame is visible in a hook-stop a
bug, or a feature?
This is the current mainline behaviour:
(top-gdb) p malloc (0)
#0 main (argc=1, argv=0x7fffffffe408) at ../../src/gdb/gdb.c:28 <<< "frame" in hook-stop.
28 memset (&args, 0, sizeof args);
$1 = 11407440
(top-gdb)
I'm inclined to consider it a bug to show the dummy frame, but I may be
missing some use cases.
Say, change normal_stop to:
normal_stop ()
{
...
- pop dummy frame
- hook-stop
- print frame
- save `return' or infcall registers
...
}
(saving infcall registers could also move up, I think, but I'll leave
that out for now)
What do you guys think?
--
Pedro Alves