From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32158 invoked by alias); 9 Apr 2013 23:41:22 -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 32149 invoked by uid 89); 9 Apr 2013 23:41:22 -0000 X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO autolearn=ham version=3.3.1 Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 09 Apr 2013 23:41:21 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id F34252EA0E; Tue, 9 Apr 2013 19:41:19 -0400 (EDT) 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 euPUADUDUfwX; Tue, 9 Apr 2013 19:41:19 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 9EA312E878; Tue, 9 Apr 2013 19:41:19 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id CA892C2B71; Tue, 9 Apr 2013 16:41:17 -0700 (PDT) Date: Wed, 10 Apr 2013 11:33:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org, thomas@schwinge.name, bug-hurd@gnu.org Subject: Re: [PATCH,HURD] Fix reading core Message-ID: <20130409234117.GC24389@adacore.com> References: <20130211020109.GK5926@type.youpi.perso.aquilenet.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130211020109.GK5926@type.youpi.perso.aquilenet.fr> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2013-04/txt/msg00263.txt.bz2 > The i386 GNU/Hurd ELF core format actually follows the uaccess gregset_t > array format, not the Mach thread state format. This fixes gdb reading > it. > > * gdb/i386gnu-nat.c (CREG_OFFSET): New macro. > (creg_offset): New array. > (CREG_ADDR): Use creg_offset instead of reg_offset. Did anyone review this? I don't know GNU/Hurd, but the patch looks very plausible. Do you have write access to the GDB repository? If not, do you have copyright assignment papers on file? This patch is small enough that we can take it as a tiny patch, but if you think you're going to send more patches, we should probably get you started on those. The ChangeLog entry above needs to be indented properly (just to be sure). Another tiny style nitpick below... > --- a/gdb/i386gnu-nat.c.original 2013-02-11 00:46:02.000000000 +0000 > +++ b/gdb/i386gnu-nat.c 2013-02-11 00:48:09.000000000 +0000 > @@ -56,8 +56,21 @@ > REG_OFFSET (ds), REG_OFFSET (es), REG_OFFSET (fs), REG_OFFSET (gs) > }; > > +/* Offset to the greg_t location where REG is stored. */ > +#define CREG_OFFSET(reg) (REG_##reg * 4) > + > +/* At CREG_OFFSET[N] is the offset to the greg_t location where > + the GDB register N is stored. */ > +static int creg_offset[] = > +{ > + CREG_OFFSET (EAX), CREG_OFFSET (ECX), CREG_OFFSET (EDX), CREG_OFFSET (EBX), > + CREG_OFFSET (UESP), CREG_OFFSET (EBP), CREG_OFFSET (ESI), CREG_OFFSET (EDI), > + CREG_OFFSET (EIP), CREG_OFFSET (EFL), CREG_OFFSET (CS), CREG_OFFSET (SS), > + CREG_OFFSET (DS), CREG_OFFSET (ES), CREG_OFFSET (FS), CREG_OFFSET (GS) > +}; Unless it was done on purpose, we try to limit the size of lines to 70 characters, only extending it to up to 80 when it makes a difference.... > + > #define REG_ADDR(state, regnum) ((char *)(state) + reg_offset[regnum]) > -#define CREG_ADDR(state, regnum) ((const char *)(state) + reg_offset[regnum]) > +#define CREG_ADDR(state, regnum) ((const char *)(state) + creg_offset[regnum]) > > > /* Get the whole floating-point state of THREAD and record the values -- Joel