run copyright.sh for 2011.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cell / gcore.exp
CommitLineData
7b6bb8da 1# Copyright 2009, 2011 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 testcases tests mixed-architecture core file support
20
21load_lib cell.exp
22
23set testfile "coremaker"
24set ppu_file "coremaker"
25set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
26set ppu_bin ${objdir}/${subdir}/${ppu_file}
27set spu_file "coremaker-spu"
28set spu_src ${srcdir}/${subdir}/${spu_file}.c
29set spu_bin ${objdir}/${subdir}/${spu_file}
30
31if {![isnative]} then {
32 return 0
33}
34
35if {[skip_cell_tests]} {
36 return 0
37}
38
39# Compile SPU binary.
40if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } {
41 unsupported "Compiling spu binary failed."
42 return -1
43}
44# Compile PPU binary.
45if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } {
46 unsupported "Embedding spu binary failed."
47 return -1
48}
49if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } {
50 unsupported "Compiling ppu binary failed."
51 return -1
52}
53
54if [get_compiler_info ${ppu_bin}] {
55 return -1
56}
57
58gdb_exit
59gdb_start
60gdb_reinitialize_dir $srcdir/$subdir
61gdb_load ${ppu_bin}
62
63if ![runto_main] then {
64 fail "Can't run to main"
65 return 0
66}
67
68gdb_test "continue" ".*Aborted.*"
69
70set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
71
72gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
73 "save a corefile" \
74{
75 -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
76 pass "save a corefile"
77 }
78 -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
79 unsupported "save a corefile"
80 return -1
81 }
82}
83
84
85# Now restart gdb and load the corefile.
86gdb_exit
87gdb_start
88gdb_reinitialize_dir $srcdir/$subdir
89gdb_load ${ppu_bin}
90
91send_gdb "core-file $objdir/$subdir/gcore.test\n"
92gdb_expect {
93 -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
94 pass "core-file command"
95 }
96 -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
97 pass "core-file command (with bad program name)"
98 }
99 -re ".*$gdb_prompt $" { fail "core-file command" }
100 timeout { fail "(timeout) core-file command" }
101}
102
103gdb_test "t 6" "Switching to thread 6.*"
104gdb_test "backtrace" ".*abort.*main.*at.*$ppu_file.c.*"
105
106for {set thread_id 1} {$thread_id < 6} {incr thread_id} {
107 gdb_test "t $thread_id" \
108 "Switching to thread $thread_id.*" \
109 "switch to thread $thread_id"
110 gdb_test "backtrace" \
111 ".*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.*" \
112 "backtrace in thread $thread_id"
113}
114
115gdb_exit
116
117return 0
This page took 0.187665 seconds and 4 git commands to generate.