From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16917 invoked by alias); 8 Oct 2012 20:47:45 -0000 Received: (qmail 16906 invoked by uid 22791); 8 Oct 2012 20:47:44 -0000 X-SWARE-Spam-Status: No, hits=-4.0 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Oct 2012 20:47:39 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id q98KlSne012341; Mon, 8 Oct 2012 22:47:29 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id q98KlQ6V031554; Mon, 8 Oct 2012 22:47:26 +0200 (CEST) Date: Mon, 08 Oct 2012 20:47:00 -0000 Message-Id: <201210082047.q98KlQ6V031554@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: hjl.tools@gmail.com CC: gdb-patches@sourceware.org In-reply-to: (hjl.tools@gmail.com) Subject: Re: PING: PATCH: PR backtrace/14646: [x32] backtrace doesn't work References: <20121003154712.GH3028@adacore.com> <201210040657.q946vJlc006566@glazunov.sibelius.xs4all.nl> <201210081948.q98Jm3D7020175@glazunov.sibelius.xs4all.nl> <201210082022.q98KM82d014759@glazunov.sibelius.xs4all.nl> 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: 2012-10/txt/msg00141.txt.bz2 > Date: Mon, 8 Oct 2012 13:38:21 -0700 > From: "H.J. Lu" > > On Mon, Oct 8, 2012 at 1:22 PM, Mark Kettenis wrote: > >> Date: Mon, 8 Oct 2012 13:04:03 -0700 > >> From: "H.J. Lu" > >> > >> On Mon, Oct 8, 2012 at 12:48 PM, Mark Kettenis wrote: > >> >> Date: Thu, 4 Oct 2012 06:57:22 -0700 > >> >> From: "H.J. Lu" > >> >> > >> >> On Wed, Oct 3, 2012 at 11:57 PM, Mark Kettenis wrote: > >> >> > > >> >> > Perhaps the user-regs.c mechanism can be used to establish eip -> pc > >> >> > and esp -> sp mappings? > >> >> > >> >> It doesn't help as long as gdbarch_pc_regnum/gdbarch_sp_regnum > >> >> are used for both frame pc/sp value and unwind pc/sp value. For x32, > >> >> we want eip/esp for frame pc/sp value and rip/rsp for unwind pc/sp > >> >> value. > >> > > >> > That probably means we need to set gdbarch_pc_regnum (and > >> > gdbarch_sp_regnum) to -1 for x32. > >> > >> We can't set gdbarch_pc_regnum/gdbarch_sp_regnum to -1: > >> > >> > >> GNU gdb (GDB) 7.5.50.20121008-cvs > >> Copyright (C) 2012 Free Software Foundation, Inc. > >> License GPLv3+: GNU GPL version 3 or later > >> This is free software: you are free to change and redistribute it. > >> There is NO WARRANTY, to the extent permitted by law. Type "show copying" > >> and "show warranty" for details. > >> This GDB was configured as "x86_64-unknown-linux-gnu". > >> For bug reporting instructions, please see: > >> ... > >> Reading symbols from > >> /export/build/gnu/glibc-x32/build-x86_64-linux/elf/sln...done. > >> (gdb) b main > >> Breakpoint 1 at 0x400c20: file sln.c, line 50. > >> (gdb) r > >> Starting program: /export/build/gnu/glibc-x32/build-x86_64-linux/elf/sln > >> /export/gnu/import/git/gdb/gdb/regcache.c:1062: internal-error: > >> regcache_read_pc: Unable to find PC > >> A problem internal to GDB has been detected, > >> further debugging may prove unreliable. > >> Quit this debugging session? (y or n) > > > > Well, obviously you'll need to implement gdbarch_read_pc() for this to > > work. And probably a few more gdbarch methods. > > What do we gain by setting gdbarch_pc_regnum/gdbarch_sp_regnum > to -1? PC and SP are RIP and RSP for x32. We need them for > stack unwind. The only unusual part is they are 64-bit although > x32 is a 32-bit environment. How about this change? Did you even try that change? > diff --git a/gdb/features/i386/x32-core.xml b/gdb/features/i386/x32-core.xml > index 1e41417..392ce24 100644 > --- a/gdb/features/i386/x32-core.xml > +++ b/gdb/features/i386/x32-core.xml > @@ -34,7 +34,7 @@ > > > > - > + > > > > @@ -44,7 +44,7 @@ > > > > - > + > > >