Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PATCH: PR corefiles/11481: gcore doesn't work on i386 without SSE
@ 2010-04-09 15:50 H.J. Lu
  2010-04-09 16:00 ` Mark Kettenis
  2010-04-09 16:02 ` Joel Brobecker
  0 siblings, 2 replies; 12+ messages in thread
From: H.J. Lu @ 2010-04-09 15:50 UTC (permalink / raw)
  To: GDB

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;


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-04-13 21:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-09 15:50 PATCH: PR corefiles/11481: gcore doesn't work on i386 without SSE H.J. Lu
2010-04-09 16:00 ` Mark Kettenis
2010-04-09 16:01   ` H.J. Lu
2010-04-09 19:15     ` Mark Kettenis
2010-04-09 20:08       ` H.J. Lu
2010-04-09 20:43         ` H.J. Lu
2010-04-10 14:49           ` Mark Kettenis
2010-04-10 15:46             ` H.J. Lu
2010-04-13 21:39               ` Mark Kettenis
2010-04-13 21:50                 ` Pedro Alves
2010-04-09 16:02 ` Joel Brobecker
2010-04-09 16:05   ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox