From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20865 invoked by alias); 9 Apr 2010 15:50:21 -0000 Received: (qmail 20854 invoked by uid 22791); 9 Apr 2010 15:50:19 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga10.intel.com (HELO fmsmga102.fm.intel.com) (192.55.52.92) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Apr 2010 15:50:14 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 09 Apr 2010 08:49:44 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.107]) by fmsmga001.fm.intel.com with ESMTP; 09 Apr 2010 08:50:09 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id C66C1812386; Fri, 9 Apr 2010 08:50:12 -0700 (PDT) Date: Fri, 09 Apr 2010 15:50:00 -0000 From: "H.J. Lu" To: GDB Subject: PATCH: PR corefiles/11481: gcore doesn't work on i386 without SSE Message-ID: <20100409155012.GA19118@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) 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: 2010-04/txt/msg00249.txt.bz2 Hi, This patch fixes gcore by not generating core regset sections which aren't supported by i386 without SSE. OK to install? Thanks. H.J. --- 2010-04-09 H.J. Lu PR corefiles/11481 * i386-linux-nat.c (i386_linux_read_description): Call i386_linux_update_regset_section to set sizes of .reg-xfp/.reg-xstate core regset sections to 0. * i386-linux-tdep.c (i386_linux_update_regset_section): New. * i386-linux-tdep.h (i386_linux_update_regset_section): New. * linux-nat.c (linux_nat_do_thread_registers): Skip empty sections. diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index d559811..780b4a9 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -963,6 +963,8 @@ i386_linux_read_description (struct target_ops *ops) { have_ptrace_getfpxregs = 0; have_ptrace_getregset = 0; + i386_linux_update_regset_section (".reg-xfp", 0); + i386_linux_update_regset_section (".reg-xstate", 0); return tdesc_i386_mmx_linux; } } diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 72aced5..c14eeea 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -567,6 +567,24 @@ static int i386_linux_sc_reg_offset[] = 0 * 4 /* %gs */ }; +/* Update size of core regset section. */ + +void +i386_linux_update_regset_section (const char *name, unsigned int size) +{ + int i; + for (i = 0; i386_linux_regset_sections[i].sect_name != NULL; i++) + if (strcmp (i386_linux_regset_sections[i].sect_name, name) == 0) + { + i386_linux_regset_sections[i].size = size; + break; + } + + if (i386_linux_regset_sections[i].sect_name == NULL) + internal_error (__FILE__, __LINE__, + _("invalid core regset secion %s"), name); +} + /* Get XSAVE extended state xcr0 from core dump. */ uint64_t diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h index 1228681..ba6e11c 100644 --- a/gdb/i386-linux-tdep.h +++ b/gdb/i386-linux-tdep.h @@ -35,6 +35,10 @@ /* Total number of registers for GNU/Linux. */ #define I386_LINUX_NUM_REGS (I386_LINUX_ORIG_EAX_REGNUM + 1) +/* Update size of core regset section. */ +extern void i386_linux_update_regset_section (const char *name, + unsigned int size); + /* Get XSAVE extended state xcr0 from core dump. */ extern uint64_t i386_linux_core_read_xcr0 (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index e7e001b..4eb029d 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -4174,8 +4174,9 @@ linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid, if (core_regset_p && sect_list != NULL) while (sect_list->sect_name != NULL) { - /* .reg was already handled above. */ - if (strcmp (sect_list->sect_name, ".reg") == 0) + /* Skip empty section and .reg was already handled above. */ + if (sect_list->size == 0 + || strcmp (sect_list->sect_name, ".reg") == 0) { sect_list++; continue;