]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp
a6727f556c1bee690e10d85598f77eae43fa35a2
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / powerpc-vsx-gcore.exp
1 # Copyright (C) 2018-2019 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 # This file is part of the gdb testsuite.
17
18 # This test checks that generating and loading a core file preserves
19 # the correct VSX register state.
20
21 if {![istarget "powerpc*-*-linux*"] || [skip_vsx_tests]} then {
22 verbose "Skipping PowerPC test for corefiles with VSX registers."
23 return
24 }
25
26 standard_testfile .c
27
28 set gen_src [standard_output_file $srcfile]
29
30 gdb_produce_source $gen_src {
31 int main() {
32 return 0;
33 }
34 }
35
36 if {[build_executable "compile" $binfile $gen_src] == -1} {
37 return -1
38 }
39
40 clean_restart $binfile
41
42 if ![runto_main] then {
43 fail "could not run to main"
44 return -1
45 }
46
47 # Check if VSX register access through gdb is supported
48 proc check_vsx_access {} {
49 global gdb_prompt
50
51 set test "vsx register access"
52 gdb_test_multiple "info reg vs0" "$test" {
53 -re "Invalid register.*\r\n$gdb_prompt $" {
54 unsupported "$test"
55 return 0
56 }
57 -re "\r\nvs0.*\r\n$gdb_prompt $" {
58 pass "$test"
59 return 1
60 }
61 }
62 return 0
63 }
64
65 if { ![check_vsx_access] } {
66 return -1
67 }
68
69 for {set i 0} {$i < 64} {incr i 1} {
70 gdb_test_no_output "set \$vs$i.uint128 = $i"
71 }
72
73 set core_filename [standard_output_file "$testfile.core"]
74 set core_generated [gdb_gcore_cmd "$core_filename" "generate core file"]
75
76 if { !$core_generated } {
77 return -1
78 }
79
80 clean_restart
81
82 set core_loaded [gdb_core_cmd "$core_filename" "load core file"]
83
84 if { $core_loaded != 1 } {
85 return -1
86 }
87
88 for {set i 0} {$i < 64} {incr i 1} {
89 gdb_test "print \$vs$i.uint128" ".* = $i" "print vs$i"
90 }