Testsuite patch for: i386: Fix internal error when prstatus in core file is too big
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-biarch-core.exp
1 # Copyright 2015 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 # Test ability to load an elf64-i386 core file. The provided core file was
17 # elf64-x8664 one but it got binary patched to i386:
18 # Elf32_Ehdr.e_machine @0x12..0x13
19 # Elf64_Ehdr.e_machine @0x12..0x13
20 # #define EM_386 3 /* Intel 80386 */
21 # #define EM_X86_64 62 /* AMD x86-64 architecture */
22 # patch @0x12: 0x3E -> 0x03
23
24 standard_testfile
25
26 if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then {
27 verbose "Skipping i386-biarch-core test."
28 return
29 }
30
31 set corebz2file ${srcdir}/${subdir}/${testfile}.core.bz2
32 set corefile ${objdir}/${subdir}/${testfile}.core
33 # Entry point of the original executable.
34 set address 0x400078
35
36 if {[catch "system \"bzip2 -dc ${corebz2file} >${corefile}\""] != 0} {
37 untested "failed bzip2"
38 return -1
39 }
40 file stat ${corefile} corestat
41 if {$corestat(size) != 102400} {
42 untested "bzip2 produces invalid result"
43 return -1
44 }
45
46 gdb_exit
47 gdb_start
48 gdb_reinitialize_dir $srcdir/$subdir
49
50 # Wrongly built GDB complains by:
51 # "..." is not a core dump: File format not recognized
52 # As the provided test core has 64bit PRSTATUS i386 built GDB cannot parse it.
53 # This is just a problem of the test care, real-world elf64-i386 file will have
54 # 32bit PRSTATUS. One cannot prepare elf64-i386 core file from elf32-i386 by
55 # objcopy as it corrupts the core file beyond all recognition.
56 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"
57
58 gdb_test "x/i $address" "\r\n\[ \t\]*$address:\[ \t\]*hlt\[ \t\]*" ".text is readable"
This page took 0.046299 seconds and 5 git commands to generate.