aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2015-02-21 15:24:20 +0100
committerJan Kratochvil <jan.kratochvil@redhat.com>2015-02-21 15:24:20 +0100
commit97a0c6972eb9eb730df3817a95f351545a8f7cac (patch)
tree9785e3f953b4c4ac8e6eda8374923237ef2d4c5f /gdb/testsuite
parenta47cd6e95a6eeaae01c96b89880330c4c1db0c4b (diff)
downloadgdb-97a0c6972eb9eb730df3817a95f351545a8f7cac.zip
gdb-97a0c6972eb9eb730df3817a95f351545a8f7cac.tar.gz
gdb-97a0c6972eb9eb730df3817a95f351545a8f7cac.tar.bz2
Testsuite patch for: i386: Fix internal error when prstatus in core file is too big
gdb/testsuite/ChangeLog 2015-02-21 Jan Kratochvil <jan.kratochvil@redhat.com> PR corefiles/17808 * gdb.arch/i386-biarch-core.core.bz2: New file. * gdb.arch/i386-biarch-core.exp: New file.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.arch/i386-biarch-core.core.bz2bin0 -> 420 bytes
-rw-r--r--gdb/testsuite/gdb.arch/i386-biarch-core.exp58
3 files changed, 64 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index c64aeda..dbcc4f6 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-21 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ PR corefiles/17808
+ * gdb.arch/i386-biarch-core.core.bz2: New file.
+ * gdb.arch/i386-biarch-core.exp: New file.
+
2015-02-21 Pedro Alves <palves@redhat.com>
* gdb.threads/multi-create-ns-info-thr.exp: Return early if
diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.core.bz2 b/gdb/testsuite/gdb.arch/i386-biarch-core.core.bz2
new file mode 100644
index 0000000..8b823f7
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/i386-biarch-core.core.bz2
Binary files differ
diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.exp b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
new file mode 100644
index 0000000..612b4d8
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
@@ -0,0 +1,58 @@
+# Copyright 2015 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test ability to load an elf64-i386 core file. The provided core file was
+# elf64-x8664 one but it got binary patched to i386:
+# Elf32_Ehdr.e_machine @0x12..0x13
+# Elf64_Ehdr.e_machine @0x12..0x13
+# #define EM_386 3 /* Intel 80386 */
+# #define EM_X86_64 62 /* AMD x86-64 architecture */
+# patch @0x12: 0x3E -> 0x03
+
+standard_testfile
+
+if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then {
+ verbose "Skipping i386-biarch-core test."
+ return
+}
+
+set corebz2file ${srcdir}/${subdir}/${testfile}.core.bz2
+set corefile ${objdir}/${subdir}/${testfile}.core
+# Entry point of the original executable.
+set address 0x400078
+
+if {[catch "system \"bzip2 -dc ${corebz2file} >${corefile}\""] != 0} {
+ untested "failed bzip2"
+ return -1
+}
+file stat ${corefile} corestat
+if {$corestat(size) != 102400} {
+ untested "bzip2 produces invalid result"
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+# Wrongly built GDB complains by:
+# "..." is not a core dump: File format not recognized
+# As the provided test core has 64bit PRSTATUS i386 built GDB cannot parse it.
+# This is just a problem of the test care, real-world elf64-i386 file will have
+# 32bit PRSTATUS. One cannot prepare elf64-i386 core file from elf32-i386 by
+# objcopy as it corrupts the core file beyond all recognition.
+gdb_test "core-file ${corefile}" "\r\nwarning: Unexpected size of section `\\.reg/6901' in core file\\.\r\n.*Core was generated by `\[^\r\n\]*'\\.\r\nProgram terminated with signal SIGSEGV, Segmentation fault\\.\r\n.*" "core-file"
+
+gdb_test "x/i $address" "\r\n\[ \t\]*$address:\[ \t\]*hlt\[ \t\]*" ".text is readable"