From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14096 invoked by alias); 1 Mar 2006 17:58:22 -0000 Received: (qmail 14084 invoked by uid 22791); 1 Mar 2006 17:58:21 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 01 Mar 2006 17:58:18 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FEVaY-0001xp-BF; Wed, 01 Mar 2006 12:58:14 -0500 Date: Wed, 01 Mar 2006 17:58:00 -0000 From: Daniel Jacobowitz To: Eli Zaretskii Cc: Jason Kraftcheck , gdb-patches@sources.redhat.com Subject: Re: fix list/edit command in hook-stop Message-ID: <20060301175814.GB6465@nevyn.them.org> Mail-Followup-To: Eli Zaretskii , Jason Kraftcheck , gdb-patches@sources.redhat.com References: <43FDFCDE.9090603@cae.wisc.edu> <20060223210220.GC2353@nevyn.them.org> <43FE336D.1010502@cae.wisc.edu> <44047AAB.4070102@cae.wisc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00012.txt.bz2 On Tue, Feb 28, 2006 at 10:08:41PM +0200, Eli Zaretskii wrote: > Thanks. However, I thought we should explain why > set_current_sal_from_frame is called here. I believe the reason is > that without the call, the current sal will not be up to date if > `edit' or `list' are called inside a hook-stop. I think the patch ought to set the sal regardless of whether a stop hook is defined. However, there's something more complicated going on. The obvious patch from my description causes lots of test failures like this one: (gdb) PASS: gdb.base/call-ar-st.exp: run until breakpoint set at a line print print_double_array(double_array) array_d : ========= 0.000000 23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600 $1 = void (gdb) PASS: gdb.base/call-ar-st.exp: print print_double_array(double_array) print print_char_array(char_array) array_c : ========= Z aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ aZaZaZaZaZaZaZaZaZa $2 = void (gdb) PASS: gdb.base/call-ar-st.exp: print print_char_array(char_array) tbreak 1216 No line 1216 in file "../sysdeps/x86_64/elf/start.S". (gdb) FAIL: gdb.base/call-ar-st.exp: tbreakpoint line 1216 The reason we're suddenly in start.S is that the breakpoint we hit after calling print_double_array is in _start. So the right patch would actually look like the attached. Is this better? -- Daniel Jacobowitz CodeSourcery 2006-03-01 Daniel Jacobowitz * frame.h (set_current_sal_from_frame): New prototype. * stack.c (set_current_sal_from_frame): Make global. * infrun.c (normal_stop): Call set_current_sal_from_frame. Index: frame.h =================================================================== RCS file: /cvs/src/src/gdb/frame.h,v retrieving revision 1.147 diff -u -p -r1.147 frame.h --- frame.h 17 Dec 2005 22:33:59 -0000 1.147 +++ frame.h 1 Mar 2006 17:53:12 -0000 @@ -300,6 +300,12 @@ extern CORE_ADDR get_frame_func (struct extern void find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal); +/* Set the current source and line to the location given by frame + FRAME, if possible. When CENTER is true, adjust so the relevant + line is in the center of the next 'list'. */ + +void set_current_sal_from_frame (struct frame_info *, int); + /* Return the frame base (what ever that is) (DEPRECATED). Old code was trying to use this single method for two conflicting Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.209 diff -u -p -r1.209 infrun.c --- infrun.c 4 Jan 2006 19:34:58 -0000 1.209 +++ infrun.c 1 Mar 2006 17:53:13 -0000 @@ -3044,6 +3044,12 @@ Further execution is probably impossible target_terminal_ours (); + /* Set the current source location. This will also happen if we + display the frame below, but the current SAL will be incorrect + during a user hook-stop function. */ + if (target_has_stack && !stop_stack_dummy) + set_current_sal_from_frame (get_current_frame (), 1); + /* Look up the hook_stop and run it (CLI internally handles problem of stop_command's pre-hook not existing). */ if (stop_command) Index: stack.c =================================================================== RCS file: /cvs/src/src/gdb/stack.c,v retrieving revision 1.137 diff -u -p -r1.137 stack.c --- stack.c 17 Dec 2005 22:34:03 -0000 1.137 +++ stack.c 1 Mar 2006 17:53:14 -0000 @@ -61,8 +61,6 @@ static void print_frame (struct frame_in enum print_what print_what, int print_args, struct symtab_and_line sal); -static void set_current_sal_from_frame (struct frame_info *, int); - /* Zero means do things normally; we are interacting directly with the user. One means print the full filename and linenumber when a frame is printed, and do so in a format emacs18/emacs19.22 can @@ -373,7 +371,7 @@ print_args_stub (void *args) FRAME, if possible. When CENTER is true, adjust so the relevant line is in the center of the next 'list'. */ -static void +void set_current_sal_from_frame (struct frame_info *frame, int center) { struct symtab_and_line sal;