diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2010-04-21 20:22:20 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2010-04-21 20:22:20 +0000 |
commit | f335d1b3959656aa939d41782ae30c4364d8560c (patch) | |
tree | 6190f9dc9ecc3b8a7f21619630f574563e4c3f14 | |
parent | a9789a6b9df7e25448473dc45c47b64c980f04b5 (diff) | |
download | gdb-f335d1b3959656aa939d41782ae30c4364d8560c.zip gdb-f335d1b3959656aa939d41782ae30c4364d8560c.tar.gz gdb-f335d1b3959656aa939d41782ae30c4364d8560c.tar.bz2 |
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.
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/amd64-linux-tdep.c | 19 | ||||
-rw-r--r-- | gdb/i386-linux-tdep.c | 32 |
3 files changed, 35 insertions, 26 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2ba55a2..07b0efc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +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. + 2010-04-21 Mike Frysinger <vapier@gentoo.org> * gdb/sparc-tdep.c (sparc32_store_return_value): Add gdb_assert () diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index f249d5d..7376ba7 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -1269,18 +1269,15 @@ amd64_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; - /* Linux/x86-64. */ - xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd); - if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK) - return tdesc_amd64_avx_linux; - else - return tdesc_amd64_linux; + uint64_t xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd); + switch ((xcr0 & I386_XSTATE_AVX_MASK)) + { + case I386_XSTATE_AVX_MASK: + return tdesc_amd64_avx_linux; + default: + return tdesc_amd64_linux; + } } static void diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 4e3408c..272cc99 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 |