Bug 9664 - [regression] stop hooks run after printing stack frame
Summary: [regression] stop hooks run after printing stack frame
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 6.8
: P3 enhancement
Target Milestone: ---
Assignee: Pedro Alves
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-26 02:28 UTC by Zoltan Varga
Modified: 2009-01-23 15:55 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zoltan Varga 2008-11-26 02:28:01 UTC
[Converted from Gnats 2559]

According to the gdb manual, stop hooks were executed before
the stack frame information was printed when the program
was stopped. This got broken by this patch:
http://sourceware.org/ml/gdb-patches/2008-09/msg00193.html

Running the hook code before printing the stack frame is
useful for things like debugging JITted code, i.e. the hook
could load symbol information for the JITted code using
add-symbol-file.

Release:
GNU gdb (GDB) 6.8.50.20081126-cvs

Environment:
debian unstable amd64

How-To-Repeat:
define hook-stop
echo "Hello."
end

break main
run

In gdb 6.8, the "Hello" message was printed before the stack
frame, in the cvs version, it is printed after.
Comment 1 Pedro Alves 2008-11-26 10:03:41 UTC
Responsible-Changed-From-To: unassigned->palves
Responsible-Changed-Why: I'll fix this.
Comment 2 Pedro Alves 2008-11-26 10:03:41 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Tagging the threads as stopped will have to
    be done a bit earlier than.  normal_stop is full of tricky bits.
Comment 3 Sourceware Commits 2009-01-23 15:47:17 UTC
Subject: Bug 9664

CVSROOT:	/cvs/src
Module name:	src
Changes by:	palves@sourceware.org	2009-01-23 15:47:03

Modified files:
	gdb            : ChangeLog infrun.c 
	gdb/testsuite  : ChangeLog 
Added files:
	gdb/testsuite/gdb.base: hook-stop-frame.c hook-stop-frame.exp 

Log message:
	2009-01-23  Pedro Alves  <pedro@codesourcery.com>
	
	PR gdb/9664:
	* infrun.c (normal_stop): Tag threads as stopped, and run the
	hook-stop before printing the stack frame.
	
	2009-01-23  Pedro Alves  <pedro@codesourcery.com>
	
	PR gdb/9664:
	* gdb.base/hook-stop-frame.c, gdb.base/hook-stop-frame.exp: New.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.10134&r2=1.10135
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/infrun.c.diff?cvsroot=src&r1=1.353&r2=1.354
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1790&r2=1.1791
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/hook-stop-frame.c.diff?cvsroot=src&r1=NONE&r2=1.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/hook-stop-frame.exp.diff?cvsroot=src&r1=NONE&r2=1.1

Comment 4 Pedro Alves 2009-01-23 15:55:21 UTC
I've just checked in a patch to address this.  The next snapshot will have this
fixed.  I've also added a new test to the testsuite so we don't forget about
this again.

Thanks for catching this!