| 1 |
330 |
jeremybenn |
# Copyright 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 |
|
|
# Contributed by Ulrich Weigand .
|
| 17 |
|
|
#
|
| 18 |
|
|
# Testsuite for Cell Broadband Engine combined debugger
|
| 19 |
|
|
# This testcases tests support for PPU-side fork during SPU debugging
|
| 20 |
|
|
|
| 21 |
|
|
load_lib cell.exp
|
| 22 |
|
|
|
| 23 |
|
|
set testfile "fork"
|
| 24 |
|
|
set ppu_file "fork"
|
| 25 |
|
|
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
|
| 26 |
|
|
set ppu_bin ${objdir}/${subdir}/${ppu_file}
|
| 27 |
|
|
set spu_file "fork-spu"
|
| 28 |
|
|
set spu_src ${srcdir}/${subdir}/${spu_file}.c
|
| 29 |
|
|
set spu_bin ${objdir}/${subdir}/${spu_file}
|
| 30 |
|
|
|
| 31 |
|
|
if {[skip_cell_tests]} {
|
| 32 |
|
|
return 0
|
| 33 |
|
|
}
|
| 34 |
|
|
|
| 35 |
|
|
# Compile SPU binary.
|
| 36 |
|
|
if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
|
| 37 |
|
|
unsupported "Compiling spu binary failed."
|
| 38 |
|
|
return -1
|
| 39 |
|
|
}
|
| 40 |
|
|
# Compile PPU binary.
|
| 41 |
|
|
if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
|
| 42 |
|
|
unsupported "Embedding spu binary failed."
|
| 43 |
|
|
return -1
|
| 44 |
|
|
}
|
| 45 |
|
|
if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
|
| 46 |
|
|
unsupported "Compiling ppu binary failed."
|
| 47 |
|
|
return -1
|
| 48 |
|
|
}
|
| 49 |
|
|
|
| 50 |
|
|
if [get_compiler_info ${ppu_bin}] {
|
| 51 |
|
|
return -1
|
| 52 |
|
|
}
|
| 53 |
|
|
|
| 54 |
|
|
gdb_exit
|
| 55 |
|
|
gdb_start
|
| 56 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
| 57 |
|
|
gdb_load ${ppu_bin}
|
| 58 |
|
|
|
| 59 |
|
|
if ![runto_main] then {
|
| 60 |
|
|
fail "Can't run to main"
|
| 61 |
|
|
return 0
|
| 62 |
|
|
}
|
| 63 |
|
|
|
| 64 |
|
|
gdb_test_no_output "set spu stop-on-load" "set spu stop-on-load"
|
| 65 |
|
|
|
| 66 |
|
|
gdb_test "continue" "Continuing\\..*Temporary breakpoint \[0-9\]+, main \\(speid=.*, argp=.*, envp=.*\\) at .*$spu_file\\.c:.*spu_write_out_intr_mbox.*" \
|
| 67 |
|
|
"run until SPU main"
|
| 68 |
|
|
|
| 69 |
|
|
gdb_test "break func" "Breakpoint \[0-9\]+ at.* file .*$spu_file.c, line \[0-9\]+\\." "break func"
|
| 70 |
|
|
gdb_test "watch var" "Watchpoint \[0-9\]+: var" "watch var"
|
| 71 |
|
|
|
| 72 |
|
|
gdb_test "continue" "Continuing\\..*Watchpoint.*Old value = 0.*New value = 1.*" \
|
| 73 |
|
|
"run until watchpoint hit"
|
| 74 |
|
|
|
| 75 |
|
|
gdb_test_no_output "delete \$bpnum" "delete watchpoint"
|
| 76 |
|
|
|
| 77 |
|
|
gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, func \\(\\) at .*$spu_file.c:.*" \
|
| 78 |
|
|
"run until breakpoint hit"
|
| 79 |
|
|
|
| 80 |
|
|
gdb_test "continue" "Continuing\\..*Program exited normally.*" \
|
| 81 |
|
|
"run until end"
|
| 82 |
|
|
|
| 83 |
|
|
gdb_exit
|
| 84 |
|
|
|
| 85 |
|
|
return 0
|