From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15697 invoked by alias); 30 Mar 2006 16:17:56 -0000 Received: (qmail 15686 invoked by uid 22791); 30 Mar 2006 16:17:55 -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; Thu, 30 Mar 2006 16:17:51 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FOzqF-0000CM-GS; Thu, 30 Mar 2006 11:17:47 -0500 Date: Thu, 30 Mar 2006 16:26:00 -0000 From: Daniel Jacobowitz To: Michael Snyder Cc: Jason Kraftcheck , gdb-patches@sources.redhat.com Subject: Re: list/edit command on frame with available symtab Message-ID: <20060330161747.GA32409@nevyn.them.org> Mail-Followup-To: Michael Snyder , Jason Kraftcheck , gdb-patches@sources.redhat.com References: <43FE018B.2050502@cae.wisc.edu> <20060223210007.GB2353@nevyn.them.org> <43FE2556.8040207@cae.wisc.edu> <440621BE.4070205@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <440621BE.4070205@redhat.com> 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/msg00364.txt.bz2 On Wed, Mar 01, 2006 at 02:35:42PM -0800, Michael Snyder wrote: > >With this patch, I get what I expect. Without this patch, stopping due > >to a sigabrt, edit and list both show whatever was the previous valid > >sal, which is probably a bug. After moving up or down a frame, they > >both report an error (in the edit case, editing a file called "unknown"). > > I've never tried it with edit, and I haven't tried it recently > with list, but my recollection is in line with Daniel's comment -- > afaik, it already works, at least for list. With what version > and configuration of gdb do you find it to be broken? OK, I see what's going on. Run gdb on coremaker from the GDB testsuite. Just load it and type run, then "list"; you'll get main. Or, list 1, run, list; you'll get line 11. Here's a slightly nicer patch to do the same thing. I'm not going to apply this right now, though, because it makes me a little nervous; it means that we try to use the unwinder automatically if there is no debug information, which could lead to e.g. error() complaining about a corrupt stack, or CFI warnings. Thoughts? Is this useful? 2006-03-30 Daniel Jacobowitz * stack.c (set_current_sal_from_frame): Unwind to earlier frames if necessary. 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 30 Mar 2006 16:13:10 -0000 @@ -370,7 +370,8 @@ print_args_stub (void *args) } /* Set the current source and line to the location given by frame - FRAME, if possible. When CENTER is true, adjust so the relevant + FRAME, if possible, or the first frame outer of FRAME with line + information. When CENTER is true, adjust so the relevant line is in the center of the next 'list'. */ static void @@ -378,7 +379,15 @@ set_current_sal_from_frame (struct frame { struct symtab_and_line sal; - find_frame_sal (frame, &sal); + do + { + find_frame_sal (frame, &sal); + if (sal.symtab) + break; + frame = get_prev_frame (frame); + } + while (frame); + if (sal.symtab) { if (center) -- Daniel Jacobowitz CodeSourcery