1 |
227 |
jeremybenn |
# Copyright 2003, 2007, 2008, 2009, 2010 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 .
|
15 |
|
|
#
|
16 |
|
|
|
17 |
|
|
# Tests for Powerpc e500 ABI
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
if $tracelevel then {
|
21 |
|
|
strace $tracelevel
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
#
|
25 |
|
|
# This file uses e500-abi.c for input.
|
26 |
|
|
#
|
27 |
|
|
|
28 |
|
|
set prms_id 0
|
29 |
|
|
set bug_id 0
|
30 |
|
|
|
31 |
|
|
if ![istarget "powerpc-*eabispe"] then {
|
32 |
|
|
verbose "Skipping e500 abi tests."
|
33 |
|
|
return
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
set testfile "e500-abi"
|
37 |
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
38 |
|
|
|
39 |
|
|
set src1 ${srcdir}/${subdir}/${testfile}.c
|
40 |
|
|
|
41 |
|
|
if { [gdb_compile ${src1} ${binfile} executable {debug nowarnings}] != "" } {
|
42 |
|
|
untested e500-abi.exp
|
43 |
|
|
return -1
|
44 |
|
|
}
|
45 |
|
|
|
46 |
|
|
gdb_start
|
47 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
48 |
|
|
gdb_load ${binfile}
|
49 |
|
|
|
50 |
|
|
#
|
51 |
|
|
# Run to `main' where we begin our tests.
|
52 |
|
|
#
|
53 |
|
|
|
54 |
|
|
if ![runto_main] then {
|
55 |
|
|
gdb_suppress_tests
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
gdb_test "b marker" "Breakpoint 2 at.*file.*e500-abi.c, line \[0-9\]+." "break marker"
|
59 |
|
|
gdb_test "continue" "Breakpoint 2.*marker.*e500-abi.c.*" "continue to marker"
|
60 |
|
|
gdb_test "finish" "Run till exit from .0.*marker.*at.*e500-abi.c.*main \\(\\) at.*e500-abi.c.*res_vec = vec_func \\(a_vec,.*goes in r3.*" "back to main (1)"
|
61 |
|
|
|
62 |
|
|
# now all the arguments of vec_func are initialized
|
63 |
|
|
|
64 |
|
|
set pattern "vec_func .a_vec_f=.0, 55., b_vec_f=.0, 66., c_vec_f=.3.14.*2.18.*, d_vec_f=.5, 4., e_vec_f=.5, 6., f_vec_f=.6, 6, 7, 1., g_vec_f=.6, 6, 7, 9., h_vec_f=.3, 2., i_vec_f=.3, 2., l_vec_f=.3, 5., m_vec_f=.6, 9.."
|
65 |
|
|
|
66 |
|
|
set pattern1 $pattern
|
67 |
|
|
append pattern1 " at.*e500-abi.c.*x = 2;"
|
68 |
|
|
|
69 |
|
|
# Now let's call the function. This function has > 8 args,
|
70 |
|
|
# the last ones will go on the stack.
|
71 |
|
|
gdb_test "p vec_func(a_vec,b_vec,c_vec,d_vec,e_vec,f_vec,g_vec,h_vec,i_vec,l_vec,m_vec)" \
|
72 |
|
|
".\[0-9\]+ = .6, 63." "call inferior function with vectors (1) "
|
73 |
|
|
|
74 |
|
|
# Let's call the function again with dummy arguments. This is to clean
|
75 |
|
|
# up the contents of the ev registers before the next call.
|
76 |
|
|
gdb_test "p vec_func(a_vec_d,b_vec_d,c_vec_d,d_vec_d,e_vec_d,f_vec_d,g_vec_d,h_vec_d,i_vec_d,l_vec_d,m_vec_d)" \
|
77 |
|
|
".\[0-9\]+ = .1, 1." "call inferior function with vectors (2) "
|
78 |
|
|
|
79 |
|
|
# Let's step into the function, to see if the args are printed correctly.
|
80 |
|
|
gdb_test "step" \
|
81 |
|
|
$pattern1 \
|
82 |
|
|
"step into vec_func"
|
83 |
|
|
|
84 |
|
|
# Let's see if the result is returned correctly.
|
85 |
|
|
gdb_test "finish" \
|
86 |
|
|
"Run till exit from .0.* at.*e500-abi.c.*main.*res_vec = vec_func .a_vec,.*goes in r3.*Value returned is.*= .6, 63." \
|
87 |
|
|
"vector value returned correctly"
|