| 1 | # Copyright 2009, 2011 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 | # Contributed by Markus Deuling <deuling@de.ibm.com>. |
| 17 | # |
| 18 | # Testsuite for Cell Broadband Engine combined debugger |
| 19 | # This testcases tests mixed-architecture backtrace support |
| 20 | |
| 21 | load_lib cell.exp |
| 22 | |
| 23 | set testfile "bt" |
| 24 | set ppu_file "bt" |
| 25 | set ppu_src ${srcdir}/${subdir}/${ppu_file}.c |
| 26 | set ppu_bin ${objdir}/${subdir}/${ppu_file} |
| 27 | set spu_file "bt-spu" |
| 28 | set spu_src ${srcdir}/${subdir}/${spu_file}.c |
| 29 | set spu_bin ${objdir}/${subdir}/${spu_file} |
| 30 | set spu2_file "bt2-spu" |
| 31 | set spu2_src ${srcdir}/${subdir}/${spu2_file}.c |
| 32 | set spu2_bin ${objdir}/${subdir}/${spu2_file} |
| 33 | |
| 34 | if {[skip_cell_tests]} { |
| 35 | return 0 |
| 36 | } |
| 37 | |
| 38 | # Compile SPU binaries. |
| 39 | if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { |
| 40 | unsupported "Compiling spu binary failed." |
| 41 | return -1 |
| 42 | } |
| 43 | if { [gdb_compile_cell_spu $spu2_src $spu2_bin executable {debug}] != "" } { |
| 44 | unsupported "Compiling spu binary failed." |
| 45 | return -1 |
| 46 | } |
| 47 | # Compile PPU binary. |
| 48 | if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { |
| 49 | unsupported "Embedding spu binary failed." |
| 50 | return -1 |
| 51 | } |
| 52 | if { [gdb_cell_embedspu $spu2_bin $spu2_bin-embed.o {debug}] != "" } { |
| 53 | unsupported "Embedding spu binary failed." |
| 54 | return -1 |
| 55 | } |
| 56 | if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o $spu2_bin-embed.o] $ppu_bin executable {debug}] != "" } { |
| 57 | unsupported "Compiling ppu binary failed." |
| 58 | return -1 |
| 59 | } |
| 60 | |
| 61 | if [get_compiler_info ${ppu_bin}] { |
| 62 | return -1 |
| 63 | } |
| 64 | |
| 65 | gdb_exit |
| 66 | gdb_start |
| 67 | gdb_reinitialize_dir $srcdir/$subdir |
| 68 | gdb_load ${ppu_bin} |
| 69 | |
| 70 | if ![runto_main] then { |
| 71 | fail "Can't run to main" |
| 72 | return 0 |
| 73 | } |
| 74 | |
| 75 | delete_breakpoints |
| 76 | gdb_test "continue" ".*Program received signal SIGABRT, Aborted.*" |
| 77 | |
| 78 | gdb_test "backtrace" ".*abort.*crash_handler.*base.*offset.*<cross-architecture call>.*main.*speid.*argp.*envp.*at.*$spu2_file.c.*<cross-architecture call>.*spe_context_run.*indirect_handler.*base.*offset.*<cross-architecture call>.*main.*speid.*argp.*envp.*at.*$spu_file.c.*<cross-architecture call>.*spe_context_run.*spe_thread.*at.*$ppu_file.c.*" |
| 79 | |
| 80 | for {set thread_id 2} {$thread_id < 7} {incr thread_id} { |
| 81 | gdb_test "t $thread_id" \ |
| 82 | "Switching to thread $thread_id.*" \ |
| 83 | "switch to thread $thread_id" |
| 84 | gdb_test "backtrace" \ |
| 85 | ".*crash_handler.*base.*offset.*<cross-architecture call>.*main.*speid.*argp.*envp.*at.*$spu2_file.c.*<cross-architecture call>.*spe_context_run.*indirect_handler.*base.*offset.*<cross-architecture call>.*main.*speid.*argp.*envp.*at.*$spu_file.c.*<cross-architecture call>.*spe_context_run.*spe_thread.*at.*$ppu_file.c.*" \ |
| 86 | "backtrace in thread $thread_id" |
| 87 | } |
| 88 | |
| 89 | gdb_exit |
| 90 | |
| 91 | return 0 |