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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.hp/] [gdb.base-hp/] [sized-enum.exp] - Blame information for rev 853

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

Line No. Rev Author Line
1 24 jeremybenn
# Copyright (C) 1997, 1998, 2007, 2008 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
# Please email any bugs, comments, and/or additions to this file to:
17
# bug-gdb@prep.ai.mit.edu
18
 
19
# GDB tests for sized enumerations
20
 
21
# This is aimed at HP-UX systems.  The HP C compiler
22
# allows specifying "char" or "short" for an enum, to
23
# indicate that it is 1 or 2 bytes long.
24
 
25
# This file was written by Satish Pai 
26
# 1997-09-24
27
 
28
if $tracelevel then {
29
        strace $tracelevel
30
        }
31
 
32
#
33
# test running programs
34
#
35
set prms_id 0
36
set bug_id 0
37
 
38
if { [skip_hp_tests] } then { continue }
39
 
40
set testfile "sized-enum"
41
set srcfile ${testfile}.c
42
set binfile ${objdir}/${subdir}/${testfile}
43
 
44
if [get_compiler_info ${binfile}] {
45
    return -1
46
}
47
 
48
if { $gcc_compiled } then { continue }
49
if {$hp_aCC_compiler} {continue}
50
 
51
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
52
     untested sized-enum.exp
53
     return -1
54
}
55
 
56
gdb_exit
57
gdb_start
58
gdb_reinitialize_dir $srcdir/$subdir
59
gdb_load ${binfile}
60
 
61
#
62
# set it up at a breakpoint so we can play with the variable values
63
#
64
 
65
if ![runto_main] then {
66
    perror "couldn't run to breakpoint"
67
    continue
68
}
69
 
70
# set a breakpoint and go there
71
send_gdb "break 34\n"
72
gdb_expect {
73
   -re "Breakpoint.*line 34.*$gdb_prompt $" { pass "set break 34" }
74
   -re "$gdb_prompt $"                     { fail "set break 34" }
75
   timeout                             { fail "(timeout) set break 34" }
76
}
77
send_gdb "continue\n"
78
gdb_expect {
79
   -re "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, main....at.*sized-enum\\.c:34\r\n34.*\r\n$gdb_prompt $" { pass "continue" }
80
   -re "$gdb_prompt $"                     { fail "continue" }
81
   timeout                             { fail "(timeout) continue" }
82
}
83
 
84
# print stuff
85
send_gdb "print normal\n"
86
gdb_expect {
87
   -re "\\$\[0-9\]* = \\{red, blue, green\\}.*$gdb_prompt $" { pass "print normal" }
88
   -re "$gdb_prompt $"                     { fail "print normal" }
89
   timeout                             { fail "(timeout) print normal" }
90
}
91
send_gdb "print small\n"
92
gdb_expect {
93
   -re "\\$\[0-9\]* = \\{pink, cyan, grey\\}.*$gdb_prompt $" { pass "print small" }
94
   -re "$gdb_prompt $"                     { fail "print small" }
95
   timeout                             { fail "(timeout) print small" }
96
}
97
send_gdb "print tiny\n"
98
gdb_expect {
99
   -re "\\$\[0-9\]* = \\{orange, yellow, brown\\}.*$gdb_prompt $" { pass "print tiny" }
100
   -re "$gdb_prompt $"                     { fail "print tiny" }
101
   timeout                             { fail "(timeout) print tiny" }
102
}
103
 
104
# print type sizes
105
send_gdb "print sizeof (Normal)\n"
106
gdb_expect {
107
   -re "\\$\[0-9\]* = 4.*$gdb_prompt $" { pass "print sizeof (Normal)" }
108
   -re "$gdb_prompt $"                     { fail "print sizeof (Normal)" }
109
   timeout                             { fail "(timeout) print sizeof (Normal)" }
110
}
111
send_gdb "print sizeof (Small)\n"
112
gdb_expect {
113
   -re "\\$\[0-9\]* = 2.*$gdb_prompt $" { pass "print sizeof (Small)" }
114
   -re "$gdb_prompt $"                     { fail "print sizeof (Small)" }
115
   timeout                             { fail "(timeout) print sizeof (Small)" }
116
}
117
send_gdb "print sizeof (Tiny)\n"
118
gdb_expect {
119
   -re "\\$\[0-9\]* = 1.*$gdb_prompt $" { pass "print sizeof (Tiny)" }
120
   -re "$gdb_prompt $"                     { fail "print sizeof (Tiny)" }
121
   timeout                             { fail "(timeout) print sizeof (Tiny)" }
122
}
123
 
124
# print types
125
send_gdb "ptype normal\n"
126
gdb_expect {
127
   -re "type = enum Normal \\{red, blue, green\\} \\\[3\\\].*$gdb_prompt $" { pass "ptype normal" }
128
   -re "$gdb_prompt $"                     { fail "ptype normal" }
129
   timeout                             { fail "(timeout) ptype normal" }
130
}
131
send_gdb "ptype small\n"
132
gdb_expect {
133
   -re "type = short enum Small \\{pink, cyan, grey\\} \\\[3\\\].*$gdb_prompt $" { pass "ptype small" }
134
   -re "$gdb_prompt $"                     { fail "ptype small" }
135
   timeout                             { fail "(timeout) ptype small" }
136
}
137
send_gdb "ptype tiny\n"
138
gdb_expect {
139
   -re "type = char enum Tiny \\{orange, yellow, brown\\} \\\[3\\\].*$gdb_prompt $" { pass "ptype tiny" }
140
   -re "$gdb_prompt $"                     { fail "ptype tiny" }
141
   timeout                             { fail "(timeout) ptype tiny" }
142
}
143
 
144
# convert to int
145
send_gdb "print (int) blue\n"
146
gdb_expect {
147
   -re "\\$\[0-9\]* = 1.*$gdb_prompt $" { pass "print (int) blue" }
148
   -re "$gdb_prompt $"                     { fail "print (int) blue" }
149
   timeout                             { fail "(timeout) print (int) blue" }
150
}
151
send_gdb "print (int) cyan\n"
152
gdb_expect {
153
   -re "\\$\[0-9\]* = 1.*$gdb_prompt $" { pass "print (int) cyan" }
154
   -re "$gdb_prompt $"                     { fail "print (int) cyan" }
155
   timeout                             { fail "(timeout) print (int) cyan" }
156
}
157
send_gdb "print (int) yellow\n"
158
gdb_expect {
159
   -re "\\$\[0-9\]* = 1.*$gdb_prompt $" { pass "print (int) yellow" }
160
   -re "$gdb_prompt $"                     { fail "print (int) yellow" }
161
   timeout                             { fail "(timeout) print (int) yellow" }
162
}
163
 
164
 
165
 

powered by: WebSVN 2.1.0

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