From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14784 invoked by alias); 11 Feb 2013 02:01:57 -0000 Received: (qmail 14774 invoked by uid 22791); 11 Feb 2013 02:01:56 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from toccata.ens-lyon.fr (HELO toccata.ens-lyon.org) (140.77.166.68) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Feb 2013 02:01:14 +0000 Received: from localhost (localhost [127.0.0.1]) by toccata.ens-lyon.org (Postfix) with ESMTP id 8330184084; Mon, 11 Feb 2013 03:01:12 +0100 (CET) Received: from toccata.ens-lyon.org ([127.0.0.1]) by localhost (toccata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LDAunTZjX+kf; Mon, 11 Feb 2013 03:01:12 +0100 (CET) Received: from type.ipv6 (youpi.is-a-geek.org [80.67.176.89]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by toccata.ens-lyon.org (Postfix) with ESMTPSA id C225584080; Mon, 11 Feb 2013 03:01:11 +0100 (CET) Received: from samy by type.ipv6 with local (Exim 4.80) (envelope-from ) id 1U4ihh-0008BI-Rv; Mon, 11 Feb 2013 03:01:09 +0100 Date: Mon, 11 Feb 2013 02:01:00 -0000 From: Samuel Thibault To: gdb-patches@sourceware.org, thomas@schwinge.name Cc: bug-hurd@gnu.org Subject: [PATCH,HURD] Fix reading core Message-ID: <20130211020109.GK5926@type.youpi.perso.aquilenet.fr> Mail-Followup-To: gdb-patches@sourceware.org, thomas@schwinge.name, bug-hurd@gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) 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: 2013-02/txt/msg00245.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. --- 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) +}; + #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