summaryrefslogtreecommitdiff
path: root/gdb/i386-linux-tdep.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-04-21 20:22:14 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-04-21 20:22:14 +0000
commit2e9157d5ff407b896faf67e01efcd7f943c5032a (patch)
treea081432014fe0b6f929f0b04265b71fef328b063 /gdb/i386-linux-tdep.c
parent369d8b6a68317b868746581b3f03340a18bd49d8 (diff)
downloadgdb-2e9157d5ff407b896faf67e01efcd7f943c5032a.tar.gz
Properly read i386 coredump.
2010-04-21 H.J. Lu <hongjiu.lu@intel.com> PR corefiles/11523 * amd64-linux-tdep.c (amd64_linux_core_read_description): Check XCR0 first. * i386-linux-tdep.c (i386_linux_core_read_xcr0): Return 0 if there is no .reg-xstate section. (i386_linux_core_read_description): Check XCR0 first.
Diffstat (limited to 'gdb/i386-linux-tdep.c')
-rw-r--r--gdb/i386-linux-tdep.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 4e3408c2670..272cc998907 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -611,7 +611,7 @@ i386_linux_core_read_xcr0 (struct gdbarch *gdbarch,
}
}
else
- xcr0 = I386_XSTATE_SSE_MASK;
+ xcr0 = 0;
return xcr0;
}
@@ -623,22 +623,24 @@ i386_linux_core_read_description (struct gdbarch *gdbarch,
struct target_ops *target,
bfd *abfd)
{
- asection *section = bfd_get_section_by_name (abfd, ".reg2");
- uint64_t xcr0;
-
- if (section == NULL)
- return NULL;
-
- section = bfd_get_section_by_name (abfd, ".reg-xfp");
- if (section == NULL)
- return tdesc_i386_mmx_linux;
-
/* Linux/i386. */
- xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd);
- if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK)
- return tdesc_i386_avx_linux;
- else
+ uint64_t xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd);
+ switch ((xcr0 & I386_XSTATE_AVX_MASK))
+ {
+ case I386_XSTATE_AVX_MASK:
+ return tdesc_i386_avx_linux;
+ case I386_XSTATE_SSE_MASK:
+ return tdesc_i386_linux;
+ case I386_XSTATE_X87_MASK:
+ return tdesc_i386_mmx_linux;
+ default:
+ break;
+ }
+
+ if (bfd_get_section_by_name (abfd, ".reg-xfp") != NULL)
return tdesc_i386_linux;
+ else
+ return tdesc_i386_mmx_linux;
}
static void