Commit | Line | Data |
---|---|---|
42a4f53d | 1 | # Copyright 2009-2019 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 | # Testcase for ea software managed cache. | |
20 | ||
21 | load_lib cell.exp | |
22 | ||
23 | set ppu_file "ea-cache" | |
24 | set ppu_src ${srcdir}/${subdir}/${ppu_file}.c | |
617cd4bc | 25 | set ppu_bin [standard_output_file ${ppu_file}] |
1ea34204 UW |
26 | set spu_file "ea-cache-spu" |
27 | set spu_src ${srcdir}/${subdir}/${spu_file}.c | |
617cd4bc | 28 | set spu_bin [standard_output_file ${spu_file}] |
1ea34204 UW |
29 | |
30 | if {[skip_cell_tests]} { | |
31 | return 0 | |
32 | } | |
33 | ||
34 | # Compile SPU binary. | |
35 | if { [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. | |
40 | if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { | |
bc6c7af4 | 41 | unsupported "embedding spu binary failed." |
1ea34204 UW |
42 | return -1 |
43 | } | |
44 | if { [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 | 49 | if [get_compiler_info] { |
1ea34204 UW |
50 | return -1 |
51 | } | |
52 | ||
53 | gdb_exit | |
54 | gdb_start | |
55 | gdb_reinitialize_dir $srcdir/$subdir | |
56 | gdb_load ${ppu_bin} | |
57 | ||
58 | if ![runto_main] then { | |
bc6c7af4 | 59 | fail "can't run to main" |
1ea34204 UW |
60 | return 0 |
61 | } | |
62 | ||
63 | # Set breakpoint in SPU binary. | |
64 | cont_spu_main | |
65 | c_to "Marker SPUEA" $spu_file.c | |
66 | ||
67 | gdb_test "p *ppe_int_ptr" \ | |
68 | ".*=.*23.*" \ | |
69 | "p *ppe_int_ptr" | |
70 | ||
71 | gdb_test "set *ppe_int_ptr=42" "" "" | |
72 | ||
73 | gdb_test "p *ppe_int_ptr" \ | |
74 | ".*=.*42.*" \ | |
75 | "p *ppe_int_ptr" | |
76 | ||
77 | # Now switch to thread 1 (PPU) and look at int_var. ppe_int_ptr points to | |
78 | # int_var and should now also contain 42 (ea cache has been flushed). | |
79 | gdb_test "t 1" \ | |
80 | ".*Switching to thread 1.*" \ | |
bb95117e | 81 | "switch to thread 1" |
1ea34204 UW |
82 | |
83 | gdb_test "p int_var" \ | |
84 | ".*=.*42.*" \ | |
85 | "p int_var on ppu" | |
86 | ||
87 | gdb_exit | |
88 | return 0 | |
89 | ||
90 |