From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27073 invoked by alias); 27 Dec 2009 22:03:22 -0000 Received: (qmail 26759 invoked by uid 22791); 27 Dec 2009 22:03:21 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 27 Dec 2009 22:03:15 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 1CD7A10DA4; Sun, 27 Dec 2009 22:03:13 +0000 (GMT) Received: from caradoc.them.org (209.195.188.212.nauticom.net [209.195.188.212]) by nan.false.org (Postfix) with ESMTP id A9997104DF; Sun, 27 Dec 2009 22:03:12 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1NP1Ch-0002rk-Ey; Sun, 27 Dec 2009 17:03:11 -0500 Date: Sun, 27 Dec 2009 22:03:00 -0000 From: Daniel Jacobowitz To: Mark Kettenis Cc: gdb-patches@sourceware.org, matz@suse.de Subject: Re: RFC: %ebp-based backtrace patch Message-ID: <20091227220311.GA3174@caradoc.them.org> Mail-Followup-To: Mark Kettenis , gdb-patches@sourceware.org, matz@suse.de References: <20090706183316.GA26074@caradoc.them.org> <200907062157.n66LvSVF007634@brahms.sibelius.xs4all.nl> <20090707130040.GA11040@caradoc.them.org> <200907080901.n6891GVC029930@brahms.sibelius.xs4all.nl> <20090708125330.GA29881@caradoc.them.org> <20091227165916.GA24409@caradoc.them.org> <200912272137.nBRLbJPq029640@glazunov.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200912272137.nBRLbJPq029640@glazunov.sibelius.xs4all.nl> User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-12/txt/msg00404.txt.bz2 On Sun, Dec 27, 2009 at 10:37:19PM +0100, Mark Kettenis wrote: > Sorry, but I don't see how this would solve things. Do you have a > diff for me to look at? Sure. Here's a version that passes signull.exp for me. I also noticed that Ubuntu has a version of this applied to amd64-tdep.c. I don't know if that has merit or not; I wouldn't expect it to matter much, given that the ABI mandates .eh_frame. -- Daniel Jacobowitz CodeSourcery 2009-12-27 Michael Matz Daniel Jacobowitz * i386-tdep.c (i386_frame_cache): Assume valid anonymous functions use a frame pointer. Index: i386-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/i386-tdep.c,v retrieving revision 1.290 diff -u -p -r1.290 i386-tdep.c --- i386-tdep.c 12 Oct 2009 15:52:28 -0000 1.290 +++ i386-tdep.c 27 Dec 2009 21:59:51 -0000 @@ -1394,12 +1394,24 @@ i386_frame_cache (struct frame_info *thi /* This will be added back below. */ cache->saved_regs[I386_EIP_REGNUM] -= cache->base; } - else + else if (cache->pc != 0 + || target_read_memory (get_frame_pc (this_frame), buf, 1)) { + /* We're in a known function, but did not find a frame + setup. Assume that the function does not use %ebp. + Alternatively, we may have jumped to an invalid + address; in that case there is definitely no new + frame in %ebp. */ get_frame_register (this_frame, I386_ESP_REGNUM, buf); cache->base = extract_unsigned_integer (buf, 4, byte_order) + cache->sp_offset; } + else + /* We're in an unknown function. We could not find the start + of the function to analyze the prologue; our best option is + to assume a typical frame layout with the caller's %ebp + saved. */ + cache->saved_regs[I386_EBP_REGNUM] = 0; } /* Now that we have the base address for the stack frame we can