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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [testsuite/] [gdb.c++/] [local.exp] - Blame information for rev 1181

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

Line No. Rev Author Line
1 1181 sfurman
# Copyright 1998, 1999, 2000, 2001, 2002 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 2 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, write to the Free Software
15
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gdb@prep.ai.mit.edu
19
 
20
# tests for local variables
21
# Written by Satish Pai  1997-07-08
22
# Cleaned by Michael Chastain  2002-04-08
23
 
24
 
25
# This file is part of the gdb testsuite
26
 
27
if $tracelevel then {
28
        strace $tracelevel
29
        }
30
 
31
#
32
# test running programs
33
#
34
set prms_id 0
35
set bug_id 0
36
 
37
if { [skip_cplus_tests] } { continue }
38
 
39
set testfile "local"
40
set srcfile ${testfile}.cc
41
set binfile ${objdir}/${subdir}/${testfile}
42
 
43
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
44
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
45
}
46
 
47
if [get_compiler_info $binfile "c++"] {
48
  return -1
49
}
50
 
51
gdb_exit
52
gdb_start
53
gdb_reinitialize_dir $srcdir/$subdir
54
gdb_load ${binfile}
55
 
56
 
57
#
58
# set it up at a breakpoint so we can play with the variable values
59
#
60
if ![runto_main] then {
61
    perror "couldn't run to breakpoint"
62
    continue
63
}
64
 
65
if ![runto 'marker1'] then {
66
    perror "couldn't run to marker1"
67
    continue
68
}
69
 
70
gdb_test "up" ".*main.*" "up from marker1"
71
 
72
# Local classes in g++ get names like "main.1::InnerLocal", just like local
73
# static variables.  Some targets use "___" instead of ".".
74
 
75
# ---
76
# Pattern 1:
77
# PASS
78
#   dwarf-2
79
#     gcc 2.95.3
80
#
81
# Pattern 2:
82
# FAIL
83
# This has a duplicate "char loc_foo" line.  This is a bug.
84
# Historically this has been an XFAIL.
85
#   dwarf-2
86
#     gcc 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD
87
#
88
# Pattern 3:
89
# PASS
90
#   stabs+
91
#     gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD
92
#
93
# Pattern 4:
94
# This an old pattern from the hppa aCC version of this file.
95
# I left it alone.
96
#
97
# chastain 2002-04-08
98
 
99
set sep "(\[.\]|___)\[0-9\]"
100
 
101
send_gdb "ptype Local\n"
102
gdb_expect {
103
  -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype Local" }
104
  -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*\}.*$gdb_prompt $" {
105
    # setup_kfail "gdb/483"
106
    fail "ptype Local (gdb/483)"
107
  }
108
  -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*Local & operator *=\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((void|)\\);\[\r\n\t \]*char loc_foo\\(char\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype Local" }
109
  -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*char loc_foo\\(char\\);\r\n\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\)\r\n\}.*$gdb_prompt $" { xpass "ptype Local (old aCC)" }
110
  -re ".*$gdb_prompt $"   {  fail "ptype Local" }
111
  timeout             { fail "(timeout) ptype Local" }
112
}
113
 
114
# DTS CLLbs14316 and CLLbs17058
115
# coulter - I added a clause for HP's aCC compiler.  We print out the type
116
#   as xx instead of const unsigned char, but we still have an expected failure
117
#   because of two reasons:
118
#   There is a number at the end of InnerLocal4 which should not be there,
119
#       DTS CLLbs14316
120
#   The line number for the class
121
# setup_xfail "hppa*-*-*" CLLbs14316
122
 
123
# ---
124
# Pattern 1:
125
# PASS
126
#   dwarf-2
127
#     2.95.3, 2.96-rh, 3.0.4, 3.1, gcc-3_1-branch, HEAD
128
#
129
# Pattern 2:
130
# PASS
131
#   stabs+
132
#     2.95.3, 2.96-rh, 3.0.4, 3.1, gcc-3_1-branch, HEAD
133
#
134
# Pattern 3:
135
# Old hppa pattern.
136
#
137
# Pattern 4:
138
# Old hppa pattern.
139
#
140
# chastain 2002-05-27
141
 
142
send_gdb "ptype InnerLocal\n"
143
gdb_expect {
144
  -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]*int il_foo\\((unsigned char const|const unsigned char) *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal (pattern 1)" }
145
  -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]*InnerLocal *& operator *=\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((void|)\\);\[\r\n\t \]*int il_foo\\(unsigned char const *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal (pattern 2)" }
146
  -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" { pass "ptype InnerLocal (old HP aCC)" }
147
  -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal4::NestedInnerLocal nest1;\r\n\r\n\[\t \]*int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\\(Local at.*local\.cc:\[0-9\]+\\)\r\n\}.*$gdb_prompt $" { pass "ptype InnerLocal (old HP aCC)" }
148
  -re ".*$gdb_prompt $"   {  fail "ptype InnerLocal" }
149
  timeout             { fail "(timeout) ptype InnerLocal" }
150
}
151
 
152
#---
153
# Pattern 1:
154
# PASS
155
#   dwarf-2
156
#     gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD
157
#
158
# Pattern 2:
159
# PASS
160
#   stabs+
161
#     gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD
162
#
163
# chastain 2002-04-08
164
 
165
send_gdb "ptype NestedInnerLocal\n"
166
gdb_expect {
167
  -re "type = class NestedInnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*int nil;\[\r\n\t \]*int nil_foo\\(int\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype NestedInnerLocal" }
168
  -re "type = class NestedInnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*int nil;\[\r\n\t \]*NestedInnerLocal *& *operator *= *\\((main${sep}::|)InnerLocal::NestedInnerLocal const *&\\);\[\r\n\t \]*NestedInnerLocal\\((main${sep}::|)InnerLocal::NestedInnerLocal const *&\\);\[\r\n\t \]*NestedInnerLocal\\((void|)\\);\[\r\n\t \]*int nil_foo\\(int\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype NestedInnerLocal" }
169
  -re ".*$gdb_prompt $"   {  fail "ptype NestedInnerLocal" }
170
  timeout             { fail "(timeout) ptype NestedInnerLocal" }
171
}
172
 
173
# gdb incorrectly interprets the NestedInnerLocal in
174
# InnerLocal::NestedInnerLocal as field name instead of a type name;
175
# See CLLbs14784.
176
 
177
#---
178
# Pattern 3:
179
# FAIL
180
# The comment above, about CLLbs14784, is still correct.
181
#   dwarf-2
182
#     gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD
183
#   stabs+
184
#     gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD
185
#
186
# chastain 2002-04-08
187
 
188
send_gdb "ptype InnerLocal::NestedInnerLocal\n"
189
gdb_expect {
190
  -re "type = class InnerLocal::NestedInnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*int nil;\[\r\n\t \]*int nil_foo\\(int\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal::NestedInnerLocal" }
191
  -re "type = class InnerLocal::NestedInnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*int nil;\[\r\n\t \]*NestedInnerLocal *& *operator *= *\\((main${sep}::|)InnerLocal::NestedInnerLocal const *&\\);\[\r\n\t \]*NestedInnerLocal\\((main${sep}::|)InnerLocal::NestedInnerLocal const *&\\);\[\r\n\t \]*NestedInnerLocal\\((void|)\\);\[\r\n\t \]*int nil_foo\\(int\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal::NestedInnerLocal" }
192
  -re "There is no field named NestedInnerLocal.*$gdb_prompt $" {
193
    # setup_kfail "gdb/482"
194
    fail "ptype InnerLocal::NestedInnerLocal (gdb/482)"
195
  }
196
  -re "No symbol .*NestedInnerLocal.* in current context.*$gdb_prompt $" { fail "ptype InnerLocal::NestedInnerLocal (bogus symbol lookup)" }
197
  -re ".*$gdb_prompt $"   {  fail "ptype InnerLocal::NestedInnerLocal" }
198
  timeout             { fail "(timeout) ptype InnerLocal::NestedInnerLocal" }
199
}

powered by: WebSVN 2.1.0

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