diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2013-10-11 18:50:56 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2013-10-11 18:50:56 +0000 |
commit | 9772d0748349e397f5b6564af529da10bc139751 (patch) | |
tree | 1961ab6e9668a0e47ebf708416f2e5f48cf2b7a2 /gdb/testsuite/gdb.arch/s390-multiarch.exp | |
parent | 679e4abfc5bfd1eb8b76e812baf263897bc18d3a (diff) | |
download | gdb-9772d0748349e397f5b6564af529da10bc139751.zip gdb-9772d0748349e397f5b6564af529da10bc139751.tar.gz gdb-9772d0748349e397f5b6564af529da10bc139751.tar.bz2 |
testsuite/ChangeLog:
2013-10-11 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.arch/s390-multiarch.exp: New file.
* gdb.arch/s390-multiarch.c: New file.
Diffstat (limited to 'gdb/testsuite/gdb.arch/s390-multiarch.exp')
-rw-r--r-- | gdb/testsuite/gdb.arch/s390-multiarch.exp | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.arch/s390-multiarch.exp b/gdb/testsuite/gdb.arch/s390-multiarch.exp new file mode 100644 index 0000000..e31ad17 --- /dev/null +++ b/gdb/testsuite/gdb.arch/s390-multiarch.exp @@ -0,0 +1,159 @@ +# Copyright 2013 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/>. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@gnu.org + +# This file is part of the gdb testsuite. + + +# This test is supported on 64-bit s390 targets only, and only when +# running native. It should be executed on a sufficiently new Linux +# kernel that provides the 'system_call' regset. + +if { ![isnative] || ![istarget s390x-*-* ] } { + verbose "Skipping s390 multi-arch tests." + return +} + +set testfile "s390-multiarch" +set srcfile "${srcdir}/${subdir}/${testfile}.c" +set binprefix "${objdir}/${subdir}/${testfile}" + +gdb_exit + +if { [get_compiler_info] } { + return -1 +} + +proc compile_and_dump {variant ccopts binfile} { + global srcfile + set compile_flags {debug} + foreach opt $ccopts { + lappend compile_flags "additional_flags=$opt" + } + set test "compile ($variant)" + if { [gdb_compile $srcfile $binfile executable $compile_flags] != "" } { + fail $test + return {} + } + pass $test + + set test "create core file ($variant)" + set corefile [core_find $binfile] + if {$corefile == ""} { + fail $test + return {} + } + pass $test + return $corefile +} + +proc test_linux_v2 {} { + set test "Linux v2" + gdb_test_multiple "info reg system_call" "$test" { + -re "system_call\[ \t\]+0x\[0-9a-z\]+\t.*" { + pass "$test" + return 1 + } + -re "Invalid register `system_call'.*" { + unsupported "$test (no system_call reg)" + return 0 + } + } + return 0 +} + +proc test_register_valid {reg variant} { + gdb_test "info reg $reg" \ + "$reg\[ \t\]+0x\[0-9a-z\]+\t.*" \ + "'$reg' exists ($variant)" +} + +proc test_register_invalid {reg variant} { + gdb_test "info reg $reg" \ + "Invalid register `$reg'.*" \ + "'$reg' must not exist ($variant)" +} + +proc test_all_core64 {core type} { + set variant "64-bit $type" + gdb_core_cmd $core "core-file ($variant)" + if { ! [test_linux_v2] } { + return + } + test_register_valid "last_break" $variant + gdb_core_cmd "${core}.2" "core-file #2 ($variant)" + test_register_invalid "system_call" $variant + gdb_core_cmd "${core}.3" "core-file #3 ($variant)" + test_register_invalid "last_break" $variant +} + +proc test_all_core31 {core type} { + set variant "31-bit $type" + gdb_core_cmd $core "core-file ($variant)" + if { ! [test_linux_v2] } { + return + } + test_register_valid "r0h" $variant + test_register_valid "last_break" $variant + gdb_core_cmd "${core}.1" "core-file #1 ($variant)" + test_register_invalid "r0h" $variant + gdb_core_cmd "${core}.2" "core-file #2 ($variant)" + test_register_invalid "system_call" $variant + gdb_core_cmd "${core}.3" "core-file #3 ($variant)" + test_register_invalid "last_break" $variant +} + +set binfile "${binprefix}-64" +set core64 [compile_and_dump 64 {-m64} $binfile] +if { $core64 != "" } { + # Remove 'system_call' and mask hwcap + remote_exec host "$binfile $core64 ${core64}.2 775 1023" + # Remove 'last_break' + remote_exec host "$binfile ${core64}.2 ${core64}.3 774" +} + +set binfile "${binprefix}-31" +set core31 [compile_and_dump 31 {-m31 -mesa} $binfile] +if { $core31 != "" } { + # Create "patched" core file by removing 'high_gprs' notes + remote_exec host "$binfile $core31 ${core31}.1 768" + # Remove 'system_call' and mask off TE and any newer capabilities + # from hwcap + remote_exec host "$binfile $core31 ${core31}.2 775 1023" + # Remove 'last_break' + remote_exec host "$binfile ${core31}.2 ${core31}.3 774" +} + +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +if { $core64 != "" } { + test_all_core64 $core64 "no exec" + gdb_load "${binprefix}-64" + test_all_core64 $core64 "with exec" +} + +gdb_test "file" ".*" "discard symbol table" \ + {Discard symbol table from `.*'\? \(y or n\) } "y" + +if { $core31 != "" } { + test_all_core31 $core31 "no exec" + gdb_load "${binprefix}-31" + test_all_core31 $core31 "with exec" +} + +gdb_exit |