]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp
gas: ginsn: remove unnecessary buffer allocation and free
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / powerpc-vsx-gcore.exp
1 # Copyright (C) 2018-2024 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 require {istarget "powerpc*-*-linux*"} allow_vsx_tests
22
23 standard_testfile .c
24
25 set gen_src [standard_output_file $srcfile]
26
27 gdb_produce_source $gen_src {
28 int main() {
29 return 0;
30 }
31 }
32
33 if {[build_executable "compile" $binfile $gen_src] == -1} {
34 return -1
35 }
36
37 clean_restart $binfile
38
39 if {![runto_main]} {
40 return -1
41 }
42
43 # Check if VSX register access through gdb is supported
44 proc check_vsx_access {} {
45 global gdb_prompt
46
47 set test "vsx register access"
48 gdb_test_multiple "info reg vs0" "$test" {
49 -re "Invalid register.*\r\n$gdb_prompt $" {
50 unsupported "$test"
51 return 0
52 }
53 -re "\r\nvs0.*\r\n$gdb_prompt $" {
54 pass "$test"
55 return 1
56 }
57 }
58 return 0
59 }
60
61 if { ![check_vsx_access] } {
62 return -1
63 }
64
65 for {set i 0} {$i < 64} {incr i 1} {
66 gdb_test_no_output "set \$vs$i.uint128 = $i"
67 }
68
69 set core_filename [standard_output_file "$testfile.core"]
70 set core_generated [gdb_gcore_cmd "$core_filename" "generate core file"]
71
72 if { !$core_generated } {
73 return -1
74 }
75
76 clean_restart
77
78 set core_loaded [gdb_core_cmd "$core_filename" "load core file"]
79
80 if { $core_loaded != 1 } {
81 return -1
82 }
83
84 for {set i 0} {$i < 64} {incr i 1} {
85 gdb_test "print \$vs$i.uint128" ".* = $i" "print vs$i"
86 }