This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
PATCH: PR corefiles/11481: gcore doesn't work on i386 without SSE
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GDB <gdb-patches at sourceware dot org>
- Date: Fri, 9 Apr 2010 08:50:12 -0700
- Subject: PATCH: PR corefiles/11481: gcore doesn't work on i386 without SSE
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
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 <hongjiu.lu@intel.com>
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;