From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18896 invoked by alias); 28 Feb 2006 16:30:46 -0000 Received: (qmail 18888 invoked by uid 22791); 28 Feb 2006 16:30:45 -0000 X-Spam-Check-By: sourceware.org Received: from mail.cae.wisc.edu (HELO mail.cae.wisc.edu) (144.92.13.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 28 Feb 2006 16:30:44 +0000 Received: from [128.104.187.108] (rincewind.neep.wisc.edu [128.104.187.108]) by mail.cae.wisc.edu (8.13.4/8.13.4) with ESMTP id k1SGUZxX019696; Tue, 28 Feb 2006 10:30:35 -0600 (CST) Message-ID: <44047AAB.4070102@cae.wisc.edu> Date: Tue, 28 Feb 2006 18:49:00 -0000 From: Jason Kraftcheck User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) MIME-Version: 1.0 To: gdb-patches@sources.redhat.com CC: Eli Zaretskii Subject: Re: fix list/edit command in hook-stop References: <43FDFCDE.9090603@cae.wisc.edu> <20060223210220.GC2353@nevyn.them.org> <43FE336D.1010502@cae.wisc.edu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-CAE-MailScanner-Information: Please contact security@engr.wisc.edu if this message contains a virus or has been corrupted in delivery. X-CAE-MailScanner: Found to be clean (benji) 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-02/txt/msg00508.txt.bz2 Eli Zaretskii wrote: ... > > I'd suggest a comment here explaining why set_current_sal_from_frame > is called. OK. 2006-02-23 Jason Kraftcheck * infrun.c (normal_stop): Set current SAL before calling hook-stop handler so edit and list commands work. * frame.h: Add delcaration of set_current_sal_from_frame * stack.c: Make set_current_sal_from_frame extern diff -urp gdb-6.4/gdb/frame.h mod/gdb/frame.h --- gdb-6.4/gdb/frame.h 2005-05-22 09:53:34.000000000 -0500 +++ mod/gdb/frame.h 2006-02-28 10:27:00.165163260 -0600 @@ -300,6 +300,14 @@ 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'. */ +extern void set_current_sal_from_frame (struct frame_info * frame, + int center); + + /* Return the frame base (what ever that is) (DEPRECATED). Old code was trying to use this single method for two conflicting diff -urp gdb-6.4/gdb/infrun.c mod/gdb/infrun.c --- gdb-6.4/gdb/infrun.c 2005-11-14 09:35:16.000000000 -0600 +++ mod/gdb/infrun.c 2006-02-28 10:27:53.734132365 -0600 @@ -3041,8 +3041,14 @@ Further execution is probably impossible /* Look up the hook_stop and run it (CLI internally handles problem of stop_command's pre-hook not existing). */ if (stop_command) - catch_errors (hook_stop_stub, stop_command, - "Error while running hook_stop:\n", RETURN_MASK_ALL); + { + /* Set current sal for use by edit or list commands if + called from within hook-stop */ + if (target_has_stack) + set_current_sal_from_frame (get_current_frame (), 1); + catch_errors (hook_stop_stub, stop_command, + "Error while running hook_stop:\n", RETURN_MASK_ALL); + } if (!target_has_stack) { diff -urp gdb-6.4/gdb/stack.c mod/gdb/stack.c --- gdb-6.4/gdb/stack.c 2005-08-18 08:26:41.000000000 -0500 +++ mod/gdb/stack.c 2006-02-28 10:27:00.205158011 -0600 @@ -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;