OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.cell/] [mem-access.exp] - Blame information for rev 394

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2009 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 Markus Deuling .
17
#
18
# Testsuite for Cell Broadband Engine combined debugger
19
# This testcases tests on PPU and SPU if variables and registers are accessible
20
# via print and set by using names and adresses.
21
 
22
load_lib cell.exp
23
 
24
set ppu_file "mem-access"
25
set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
26
set ppu_bin ${objdir}/${subdir}/${ppu_file}
27
set spu_file "mem-access-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
# Get the adress to symbol name. If $reg
55
# is set to 1, get address from a register.
56
proc get_adress_from_name { name reg } {
57
  global gdb_prompt
58
  set adr ""
59
 
60
  if { $reg == 1 } {
61
    set q "x/x $name"
62
  } else {
63
    set q "x/x &$name"
64
  }
65
 
66
  gdb_test_multiple $q "get address from $name" {
67
    -re "(0x.....):.*$gdb_prompt $" { # Registers.
68
      set adr $expect_out(1,string)
69
      pass "get adress from $name = $adr"
70
    }
71
    -re "(0x........) <.*$gdb_prompt $" { # PPU address.
72
      set adr $expect_out(1,string)
73
      pass "get adress from $name = $adr"
74
    }
75
    -re "(0x....) <.*$gdb_prompt $" { # SPU address.
76
      set adr $expect_out(1,string)
77
      pass "get adress from $name = $adr"
78
    }
79
    -re "(0x...) <.*$gdb_prompt $" { # SPU address.
80
      set adr $expect_out(1,string)
81
      pass "get adress from $name = $adr"
82
    }
83
  }
84
 
85
  return ${adr}
86
}
87
 
88
# Try to set a $value at adress $adr.
89
proc set_adr_content { adr value } {
90
  gdb_test "set *$adr=$value" \
91
           "" \
92
           "set *$adr=$value"
93
}
94
 
95
# Try to set a $value for $symbol.
96
proc set_symbol_content { symbol value } {
97
  gdb_test "set $symbol=$value" \
98
           "" \
99
           "set *$symbol=$value"
100
}
101
 
102
# Check if $value is at *adr
103
proc test_adr_content { adr value } {
104
  gdb_test "p *$adr" \
105
           ".*=.*$value.*" \
106
           "(ptr) *$adr==$value"
107
}
108
 
109
proc test_symbol_content { symbol value } {
110
  gdb_test "p $symbol" \
111
           ".*=.*$value.*" \
112
           "(symbol) $symbol==$value"
113
}
114
 
115
# Check VARNAME. Check if it has the inital
116
# value INITIALVALUE. Set it to NEWVALUE.
117
# Check if set properly. Do it via symbols and
118
# pointers.
119
proc check_var { varname initalvalue newvalue } {
120
 
121
  # Initial value should be $initalvalue.
122
  test_symbol_content $varname $initalvalue
123
 
124
  # Get pointer to symbol and check if the
125
  # initial value is found.
126
  set adr [get_adress_from_name $varname 0]
127
  test_adr_content $adr $initalvalue
128
 
129
  # Re-set value using the pointer.
130
  set_adr_content $adr $newvalue
131
 
132
  # Test values by pointer and by symbol.
133
  test_adr_content $adr $newvalue
134
  test_symbol_content $varname $newvalue
135
 
136
  # Set value back to initalvalue using symbol
137
  # name and check it.
138
  set_symbol_content $varname $initalvalue
139
  test_adr_content $adr $initalvalue
140
  test_symbol_content $varname $initalvalue
141
}
142
 
143
gdb_exit
144
gdb_start
145
gdb_reinitialize_dir $srcdir/$subdir
146
gdb_load ${ppu_bin}
147
 
148
if ![runto_main] then {
149
  fail "Can't run to main"
150
  return 0
151
}
152
 
153
# Check in PPU thread.
154
c_to "Marker PPUEA" $ppu_file.c
155
check_var "test_var" 5 7
156
 
157
# Go to SPU thread.
158
cont_spu_main
159
c_to "Marker SPUEA" $spu_file.c
160
check_spu_arch ""
161
 
162
# Check in SPU thread.
163
check_var "test_var" 5 7
164
# Check $sp register.
165
set adr [get_adress_from_name "\$sp" 1]
166
set_adr_content $adr 8
167
test_adr_content $adr 8
168
 
169
gdb_exit
170
return 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.