]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.cell/arch.exp
Fix test names starting with uppercase output by basic functions
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cell / arch.exp
CommitLineData
618f726f 1# Copyright 2009-2016 Free Software Foundation, Inc.
1ea34204
UW
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# Contributed by Markus Deuling <deuling@de.ibm.com>.
17#
18# Testsuite for Cell Broadband Engine combined debugger
19# This testcase checks if the "show architecture" command works properly.
20
21load_lib cell.exp
22
23set ppu_file "break"
24set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
25set ppu_bin ${objdir}/${subdir}/${ppu_file}
26set spu_file "break-spu"
27set spu_src ${srcdir}/${subdir}/${spu_file}.c
28set spu_bin ${objdir}/${subdir}/${spu_file}
29
30if {[skip_cell_tests]} {
31 return 0
32}
33
34# Compile SPU binary.
35if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
bc6c7af4 36 unsupported "compiling spu binary failed."
1ea34204
UW
37 return -1
38}
39# Compile PPU binary.
40if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
bc6c7af4 41 unsupported "embedding spu binary failed."
1ea34204
UW
42 return -1
43}
44if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
bc6c7af4 45 unsupported "compiling ppu binary failed."
1ea34204
UW
46 return -1
47}
48
4c93b1db 49if [get_compiler_info] {
1ea34204
UW
50 return -1
51}
52
53gdb_exit
54gdb_start
55gdb_reinitialize_dir $srcdir/$subdir
56gdb_load ${ppu_bin}
57
58# No programm running, default architecture should be powerpc:common.
59gdb_test "show architecture" \
60 "The target architecture is set automatically.*currently powerpc:common.*" \
61 "startup architecture is powerpc:common"
62
63if ![runto_main] then {
bc6c7af4 64 fail "can't run to main"
1ea34204
UW
65 return 0
66}
67
68# In PPU thread, architecture should be powerpc:common.
69gdb_test "show architecture" \
70 "The target architecture is set automatically.*currently powerpc:common.*" \
71 "ppu architecture is powerpc:common"
72
73# Switch to SPU thread.
74cont_spu_main
75check_spu_arch ""
76
77# Remember thread ID of first thread to hit SPU main.
78send_gdb "thread\n"
79gdb_expect 10 {
80 -re "Current thread is (\[0-9\]*) .*\r\n$gdb_prompt $" {
bc6c7af4 81 pass "retrieve current thread"
1ea34204
UW
82 set thread_id $expect_out(1,string)
83 }
84 -re "$gdb_prompt $" {
bc6c7af4 85 fail "retrieve current thread"
1ea34204
UW
86 return 0
87 }
88 timeout {
bc6c7af4 89 fail "retrieve current thread (timed out)"
1ea34204
UW
90 return 0
91 }
92}
93
94# Stress Test: Switching from PPU- to SPU-Thread and back 'rep' times.
95set rep 100
96for {set i 0} {$i < $rep} {incr i} {
97 # Switch to PPU Thread.
98 gdb_test "t 1" \
99 "Switching to thread 1.*" \
100 "switch back to thread 1 (PPU) #$i"
101 # In PPU Thread, architecture should again be powerpc:common.
102 gdb_test "show architecture" \
103 "The target architecture is set automatically.*currently powerpc:common.*" \
104 "ppu architecture is powerpc:common again #$i"
105 # Thread switching to SPU.
106 gdb_test "t $thread_id" \
107 "Switching to thread $thread_id.*at.*$spu_file.c.*" \
108 "switch back to thread $thread_id (spu) #$i"
109 # Standing in SPU thread again, architecture should be spu:256K again.
110 check_spu_arch "spu architecture is spu256K again #$i"
111}
112# End of Stress Test loop
113
114gdb_exit
115
116return 0