From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13114 invoked by alias); 11 Jul 2002 18:56:01 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 13102 invoked from network); 11 Jul 2002 18:56:00 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 11 Jul 2002 18:56:00 -0000 Received: from dsl254-114-096.nyc1.dsl.speakeasy.net ([216.254.114.96] helo=nevyn.them.org) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 17Sj6e-0005WQ-00 for ; Thu, 11 Jul 2002 13:56:00 -0500 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 17Sj6h-0005k1-00 for ; Thu, 11 Jul 2002 14:56:03 -0400 Date: Thu, 11 Jul 2002 12:02:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: [RFA]: Fix bug gdb/321 Message-ID: <20020711185603.GA22051@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20020711205208.U21857@cygbert.vinschen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020711205208.U21857@cygbert.vinschen.de> User-Agent: Mutt/1.5.1i X-SW-Source: 2002-07/txt/msg00239.txt.bz2 On Thu, Jul 11, 2002 at 08:52:08PM +0200, Corinna Vinschen wrote: > Hi, > > the following patch seems to fix the bug described in gdb/321: > > http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=321 > > Basically the problem is that gdb's backtrace reports the wrong calling > function if a function ends in a call to abort() (or another noreturn func) > under some conditions. The bug report suggests to use a by one decremented > pc when evaluating the function. The following patch does exactly this by > using the return value of frame_address_in_block() instead of frame->pc in > calls which evaluate symbols. FWIW, I think this is perfect - thanks! > > Corinna > > ChangeLog: > > * stack.c (print_frame): Use result of frame_address_in_block() > instead of fi->pc when evaluating symbols. > (backtrace_command_1): Ditto. > > Index: stack.c > =================================================================== > RCS file: /cvs/src/src/gdb/stack.c,v > retrieving revision 1.39 > diff -u -p -r1.39 stack.c > --- stack.c 10 Jun 2002 23:25:50 -0000 1.39 > +++ stack.c 11 Jul 2002 18:42:47 -0000 > @@ -461,7 +461,7 @@ print_frame (struct frame_info *fi, > stb = ui_out_stream_new (uiout); > old_chain = make_cleanup_ui_out_stream_delete (stb); > > - func = find_pc_function (fi->pc); > + func = find_pc_function (frame_address_in_block (fi)); > if (func) > { > /* In certain pathological cases, the symtabs give the wrong > @@ -480,7 +480,7 @@ print_frame (struct frame_info *fi, > ever changed many parts of GDB will need to be changed (and we'll > create a find_pc_minimal_function or some such). */ > > - struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc); > + struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (frame_address_in_block (fi)); > if (msymbol != NULL > && (SYMBOL_VALUE_ADDRESS (msymbol) > > BLOCK_START (SYMBOL_BLOCK_VALUE (func)))) > @@ -528,7 +528,7 @@ print_frame (struct frame_info *fi, > } > else > { > - struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc); > + struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (frame_address_in_block (fi)); > if (msymbol != NULL) > { > funname = SYMBOL_NAME (msymbol); > @@ -1111,7 +1111,7 @@ backtrace_command_1 (char *count_exp, in > fi = get_prev_frame (fi)) > { > QUIT; > - ps = find_pc_psymtab (fi->pc); > + ps = find_pc_psymtab (frame_address_in_block (fi)); > if (ps) > PSYMTAB_TO_SYMTAB (ps); /* Force syms to come in */ > } > > -- > Corinna Vinschen > Cygwin Developer > Red Hat, Inc. > mailto:vinschen@redhat.com > -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer