From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9564 invoked by alias); 30 Nov 2014 15:20:45 -0000 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 Received: (qmail 9552 invoked by uid 89); 30 Nov 2014 15:20:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sun, 30 Nov 2014 15:20:42 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 2657F1164D4; Sun, 30 Nov 2014 10:20:41 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id J1skPCJZsVlV; Sun, 30 Nov 2014 10:20:41 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id BE5AD116496; Sun, 30 Nov 2014 10:20:40 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id BE15740EAE; Sun, 30 Nov 2014 19:20:36 +0400 (RET) Date: Sun, 30 Nov 2014 15:20:00 -0000 From: Joel Brobecker To: David Taylor Cc: gdb-patches@sourceware.org Subject: Re: RFA bug fix -- x86-64 stabs and deprecated fp register Message-ID: <20141130152036.GC4882@adacore.com> References: <3508.1416603484@usendtaylorx2l> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3508.1416603484@usendtaylorx2l> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-11/txt/msg00747.txt.bz2 David, On Fri, Nov 21, 2014 at 03:58:04PM -0500, David Taylor wrote: > Sometimes when using STABS on x86-64 GNU/Linux, GDB does not know which > register to use for the frame pointer and as a result offsets from the > frame pointer are treated as absolute addresses rather than as > offsets... > > This patch provides a default for when the debug information doesn't > specify which register to use. > > We have seen this problem when debugging problems with a previous > release of our software (I believe it was built with GCC 4.5.x, if that > matters). > > There were no regressions on x86-64 GNU/Linux. > > 2014-11-21 David Taylor > > * amd64-tdep.c (amd64_init_abi): Set default frame pointer. I don't think your patch is correct, as it is going to affect the outcome of... (gdb) print $fp ... for frameless functions compiled with DWARF2. See std-regs.c:value_of_builtin_frame_fp_reg. If we were to apply your patch, it would unconditionally print the contents of the %rbp register as the result, which is not what we've been printing so far. I wish I could suggest another approach but I haven't had to touch stabs support in several years, now. If you provided a bit more details as to what actually happened in the debugger and where, I might be able to help you better. > diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c > index e69da01..5a68c33 100644 > --- a/gdb/amd64-tdep.c > +++ b/gdb/amd64-tdep.c > @@ -3006,6 +3006,8 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch * > gdbarch) > set_gdbarch_ps_regnum (gdbarch, AMD64_EFLAGS_REGNUM); /* %eflags */ > set_gdbarch_fp0_regnum (gdbarch, AMD64_ST0_REGNUM); /* %st(0) */ > > + set_gdbarch_deprecated_fp_regnum (gdbarch, AMD64_RBP_REGNUM); /* %rbp */ > + > /* The "default" register numbering scheme for AMD64 is referred to > as the "DWARF Register Number Mapping" in the System V psABI. > The preferred debugging format for all known AMD64 targets is -- Joel