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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gdb-7.2/] [gdb-7.2-or32-1.0rc3/] [gdb/] [testsuite/] [gdb.base/] [miscexprs.exp] - Blame information for rev 513

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 1998, 1999, 2000, 2007, 2008, 2009, 2010
2
# Free Software Foundation, Inc.
3
 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see .
16
 
17
 
18
# This file is part of the gdb testsuite
19
# file written by Elena Zannoni (ezannoni@cygnus.com)
20
 
21
#
22
# tests for expressions with struct/array elements and mixed operator types
23
# with elementary types
24
#
25
 
26
if $tracelevel then {
27
        strace $tracelevel
28
        }
29
 
30
# By default, the datastructures are allocated on the stack.  For targets
31
# with very small stack, that will not work.  In that case, just set
32
# storage to `-DSTORAGE=static' which changes the datastructures to be
33
# allocated in data segment.
34
set storage "-DSTORAGE="
35
if [target_info exists gdb,small_stack_section] {
36
    set storage "-DSTORAGE=static"
37
}
38
 
39
set additional_flags "additional_flags=${storage}"
40
 
41
#
42
# test running programs
43
#
44
 
45
set testfile "miscexprs"
46
set srcfile ${testfile}.c
47
set binfile ${objdir}/${subdir}/${testfile}
48
 
49
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ${additional_flags} nowarnings]] != "" } {
50
    untested miscexprs.exp
51
    return -1
52
}
53
 
54
if [get_compiler_info ${binfile}] {
55
    return -1;
56
}
57
 
58
gdb_exit
59
gdb_start
60
gdb_reinitialize_dir $srcdir/$subdir
61
gdb_load ${binfile}
62
 
63
 
64
#
65
# set it up at a breakpoint so we can play with the variable values
66
#
67
if ![runto_main] then {
68
    perror "couldn't run to breakpoint"
69
    continue
70
}
71
 
72
gdb_test "break marker1" ".*" ""
73
 
74
gdb_test "cont" \
75
    "Break.* marker1 \\(\\) at .*:$decimal.*" \
76
    "continue to marker1"
77
 
78
gdb_test "up" " main .*" "up from marker1"
79
 
80
global hex
81
 
82
gdb_test "print &ibig.i\[0\]" " = \\(int \\*\\) $hex" \
83
    "print value of &ibig.i\[0\]"
84
 
85
gdb_test_multiple "print &cbig.c\[0\]" "print value of &cbig.c\[0\]" {
86
    -re ".\[0-9\]* = $hex \"\".*$gdb_prompt $" {
87
        pass "print value of &cbig.c\[0\]"
88
    }
89
    -re ".\[0-9\]* = $hex \"*\".*$gdb_prompt $" {
90
        pass "print value of &cbig.c\[0\]"
91
    }
92
}
93
 
94
gdb_test "print &fbig.f\[0\]" " = \\(float \\*\\) $hex" \
95
    "print value of &fbig.f\[0\]"
96
 
97
gdb_test "print &dbig.d\[0\]" " = \\(double \\*\\) $hex" \
98
    "print value of &dbig.d\[0\]"
99
 
100
gdb_test_multiple "print &sbig.s\[0\]" "print value of &sbig.s\[0\]" {
101
    -re ".\[0-9\]* = \\(short \\*\\) $hex.*$gdb_prompt $" {
102
        pass "print value of &sbig.s\[0\]"
103
    }
104
    -re ".\[0-9\]* = \\(short int \\*\\) $hex.*$gdb_prompt $" {
105
        pass "print value of &sbig.s\[0\]"
106
    }
107
}
108
 
109
gdb_test_multiple "print &lbig.l\[0\]" "print value of &lbig.l\[0\]" {
110
    -re ".\[0-9\]* = \\(long \\*\\) $hex.*$gdb_prompt $" {
111
        pass "print value of &lbig.l\[0\]"
112
    }
113
    -re ".\[0-9\]* = \\(long int \\*\\) $hex.*$gdb_prompt $" {
114
        pass "print value of &lbig.l\[0\]"
115
    }
116
}
117
 
118
gdb_test "print ibig.i\[100\] | 1" " = 5" \
119
    "print value of ibig.i\[100\] | 1"
120
 
121
gdb_test "print sbig.s\[90\] & 127" " = 127" \
122
    "print value of sbig.s\[90\] & 127"
123
 
124
gdb_test "print !ibig.i\[100\]" " = $false" \
125
    "print value of !ibig.i\[100\]"
126
 
127
gdb_test "print !sbig.s\[90\]" " = $false" \
128
    "print value of !sbig.s\[90\]"
129
 
130
gdb_test "print !fbig.f\[100\]" " = $false" \
131
    "print value of !ibig.i\[100\]"
132
 
133
gdb_test "print !dbig.d\[202\]" " = $false" \
134
    "print value of !ibig.i\[100\]"
135
 
136
gdb_test "print sbig.s\[90\] * 10" " = 2550" \
137
    "print value of !sbig.s\[90\] * 10"
138
 
139
gdb_test "print ibig.i\[100\] * sbig.s\[90\]" " = 1275" \
140
    "print value of ibig.i\[100\] * sbig.s\[90\]"
141
 
142
gdb_test "print fbig.f\[100\] * dbig.d\[202\]" " = 119.99\[0-9\]*" \
143
    "print value of fbig.f\[100\] * dbig.d\[202\]"
144
 
145
gdb_test "print !(sbig.s\[90\] * 2)" " = $false" \
146
    "print value of !(sbig.s\[90\] * 2)"
147
 
148
gdb_test "print sizeof(sbig)" " = 800" "print value of sizeof sbig"
149
 
150
gdb_test "print sizeof(cbig)" " = 100" "print value of sizeof cbig"
151
 
152
gdb_test "print sizeof(lbig)/sizeof(long)" " = 900" \
153
    "print value of sizeof lbig / sizeof long"
154
 
155
gdb_test "print ibig.i\[100\] << 2" " = 20" \
156
    "print value of ibig.i\[100\] << 2"
157
 
158
gdb_test "print sbig.s\[90\] >> 4" " = 15" \
159
    "print value of sbig.s\[90\] >> 4"
160
 
161
gdb_test "print lbig.l\[333\] >> 6" " = 15624999" \
162
    "print value of lbig.l\[333\] >> 6"
163
 

powered by: WebSVN 2.1.0

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