1 # Copyright 2009-2017 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Contributed by Markus Deuling <deuling@de.ibm.com>.
18 # Testsuite for Cell Broadband Engine combined debugger
19 # This testcases tests mixed-architecture core file support
23 set testfile "coremaker"
24 set ppu_file "coremaker"
25 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
26 set ppu_bin ${objdir}/${subdir}/${ppu_file}
27 set spu_file "coremaker-spu"
28 set spu_src ${srcdir}/${subdir}/${spu_file}.c
29 set spu_bin ${objdir}/${subdir}/${spu_file}
31 if {![isnative]} then {
35 if {[skip_cell_tests]} {
40 if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
41 unsupported "compiling spu binary failed."
45 if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
46 unsupported "embedding spu binary failed."
49 if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
50 unsupported "compiling ppu binary failed."
54 if [get_compiler_info] {
58 # Run program to generate a core file -- see gdb.base/corefile.exp
60 set coredir "${objdir}/${subdir}/coredir.[getpid]"
62 catch "system \"(cd ${coredir}; ulimit -c unlimited; ${ppu_bin}; true) >/dev/null 2>&1\""
63 set names [glob -nocomplain -directory $coredir core.*]
64 if {[llength $names] == 1} {
65 set corefile [file join $coredir [lindex $names 0]]
66 remote_exec build "mv $corefile ${objdir}/${subdir}/corefile"
69 remote_exec build "rmdir $coredir"
71 warning "can't generate a core file - core tests suppressed - check ulimit -c"
77 gdb_reinitialize_dir $srcdir/$subdir
80 send_gdb "core-file $objdir/$subdir/corefile\n"
82 -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
83 pass "core-file command"
85 -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
86 pass "core-file command (with bad program name)"
88 -re ".*$gdb_prompt $" { fail "core-file command" }
89 timeout { fail "(timeout) core-file command" }
92 gdb_test "backtrace" ".*abort.*main.*at.*$ppu_file.c.*"
94 for {set thread_id 2} {$thread_id < 7} {incr thread_id} {
95 gdb_test "t $thread_id" \
96 "Switching to thread $thread_id.*" \
97 "switch to thread $thread_id"
98 gdb_test "backtrace" \
99 ".*terminal_func.*factorial_func.*value=1.*factorial_func.*value=2.*factorial_func.*value=3.*factorial_func.*value=4.*factorial_func.*value=5.*factorial_func.*value=6.*main.*speid.*argp.*envp.*at.*$spu_file.c.*<cross-architecture call>.*spe_context_run.*spe_thread.*at.*$ppu_file.c.*" \
100 "backtrace in thread $thread_id"