This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: PATCH: PR corefiles/11481: gcore doesn't work on i386 without SSE
On Fri, Apr 9, 2010 at 1:08 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Apr 9, 2010 at 12:15 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>>> Date: Fri, 9 Apr 2010 09:01:01 -0700
>>> From: "H.J. Lu" <hjl.tools@gmail.com>
>>>
>>> On Fri, Apr 9, 2010 at 8:59 AM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>>> >> Date: Fri, 9 Apr 2010 08:50:12 -0700
>>> >> From: "H.J. Lu" <hongjiu.lu@intel.com>
>>> >>
>>> >> Hi,
>>> >>
>>> >> This patch fixes gcore by not generating core regset sections which
>>> >> aren't supported by i386 without SSE. ?OK to install?
>>> >
>>> > Sorry, I think this is the wrong way to fix this.
>>> >
>>>
>>> Any suggestions?
>>
>> Yup. ?This makes sure we always install a list of register notes that
>> matches the target description.
>>
>> 2010-04-09 ?Mark Kettenis ?<kettenis@gnu.org>
>>
>> ? ? ? ?* i386-linux-tdep.c (i386_linux_regset_sections): Remove extended
>> ? ? ? ?register note sections.
>> ? ? ? ?(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
>> ? ? ? ?New variables.
>> ? ? ? ?(i386_linux_init_abi): Install list of supported register note
>> ? ? ? ?sections that matches the target description.
>>
>
> That is nice. We should do the same thing in amd64-linux-tdep.c.
>
My second thought. No need to change amd64-linux-tdep.c.
We can just add i386_linux_mmx_regset_sections. OK to install?
Thanks.
H.J.
---
2010-04-09 Mark Kettenis <kettenis@gnu.org>
H.J. Lu <hongjiu.lu@intel.com>
* i386-linux-tdep.c (i386_linux_mmx_regset_sections): New variable.
(i386_linux_init_abi): Call set_gdbarch_core_regset_sections with
i386_linux_mmx_regset_sections if SSE isn't available.
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 72aced5..3fc7ef0 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -54,6 +54,13 @@
#include "features/i386/i386-avx-linux.c"
/* Supported register note sections. */
+static struct core_regset_section i386_linux_mmx_regset_sections[] =
+{
+ { ".reg", 144, "general-purpose" },
+ { ".reg2", 108, "floating-point" },
+ { NULL, 0 }
+};
+
static struct core_regset_section i386_linux_regset_sections[] =
{
{ ".reg", 144, "general-purpose" },
@@ -862,7 +869,12 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbar
ch *gdbarch)
svr4_fetch_objfile_link_map);
/* Install supported register note sections. */
- set_gdbarch_core_regset_sections (gdbarch, i386_linux_regset_sections);
+ if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse"))
+ set_gdbarch_core_regset_sections (gdbarch,
+ i386_linux_regset_sections);
+ else
+ set_gdbarch_core_regset_sections (gdbarch,
+ i386_linux_mmx_regset_sections);
set_gdbarch_core_read_description (gdbarch,
i386_linux_core_read_description);
--
H.J.