From: "H.J. Lu" <hongjiu.lu@intel.com>
To: GDB <gdb-patches@sourceware.org>
Subject: PATCH: PR corefiles/11481: gcore doesn't work on i386 without SSE
Date: Fri, 09 Apr 2010 15:50:00 -0000 [thread overview]
Message-ID: <20100409155012.GA19118@intel.com> (raw)
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;
next reply other threads:[~2010-04-09 15:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-09 15:50 H.J. Lu [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100409155012.GA19118@intel.com \
--to=hongjiu.lu@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=hjl.tools@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox