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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.hp/] [gdb.base-hp/] [sized-enum.exp] - Blame information for rev 835

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

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

powered by: WebSVN 2.1.0

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