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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.hp/] [gdb.aCC/] [namespace.exp] - Blame information for rev 1774

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

Line No. Rev Author Line
1 106 markom
# Copyright (C) 1997, 1998 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 namespaces
21
# Written by Satish Pai  1997-07-23
22
 
23
# This file is part of the gdb testsuite
24
 
25
# Note: These tests are geared to the HP aCC compiler,
26
# which has an idiosyncratic way of emitting debug info
27
# for namespaces.
28
 
29
 
30
if $tracelevel then {
31
        strace $tracelevel
32
        }
33
 
34
set prms_id 0
35
set bug_id 0
36
 
37
if { [skip_hp_tests] } then { continue }
38
 
39
set testfile "namespace"
40
set srcfile ${testfile}.cc
41
set binfile ${objdir}/${subdir}/${testfile}
42
 
43
if [get_compiler_info ${binfile}] {
44
    return -1;
45
}
46
 
47
if { $gcc_compiled } then { continue }
48
if {[skip_hp_tests]} then { continue }
49
 
50
 
51
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
52
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will a
53
utomatically fail."
54
}
55
 
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
send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
73
    send_gdb "cont\n"
74
    gdb_expect {
75
        -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
76
            send_gdb "up\n"
77
            gdb_expect {
78
                -re ".*$gdb_prompt $" { pass "up from marker1" }
79
                timeout { fail "up from marker1" }
80
            }
81
        }
82
        -re "$gdb_prompt $" { fail "continue to marker1"  }
83
        timeout { fail "(timeout) continue to marker1"  }
84
    }
85
 
86
# Access a data item inside a namespace using colons and
87
# single quotes :-(
88
 
89
send_gdb "print 'AAA::c'\n"
90
gdb_expect {
91
   -re "\\$\[0-9\]* = 0 '\\\\000'\r\n$gdb_prompt $" { pass "print 'AAA::c'" }
92
   -re ".*$gdb_prompt $" { fail "print 'AAA::c'" }
93
   timeout { fail "(timeout) print 'AAA::c'" }
94
}
95
 
96
# An object declared using "using".
97
 
98
send_gdb "print ina\n"
99
gdb_expect {
100
   -re "\\$\[0-9\]+ = {xx = 33}.*$gdb_prompt $" {
101
      pass "print ina"
102
   }
103
   -re ".*$gdb_prompt $" { fail "print ina" }
104
   timeout { fail "(timeout) print ina" }
105
}
106
 
107
send_gdb "ptype ina\n"
108
gdb_expect {
109
   -re "type = class AAA::inA \{\r\n\[ \]*public:\r\n\[ \]*int xx;\r\n\[ \]*\r\n\[ \]*int fum\\(int\\);\r\n\}\r\n$gdb_prompt $" {
110
       pass "ptype ina"
111
   }
112
   -re ".*$gdb_prompt $" { fail "ptype ina" }
113
   timeout { fail "(timeout) ptype ina" }
114
}
115
 
116
# Check all functions are known to GDB
117
 
118
setup_xfail hppa*-*-*11* CLLbs14869
119
send_gdb "info func xyzq\n"
120
gdb_expect {
121
   -re "All functions.*File.*namespace.cc:\r\nint AAA::A_xyzq\\(int\\);\r\nint BBB::B_xyzq\\(int\\);\r\nchar AAA::xyzq\\(char\\);\r\nchar BBB::xyzq\\(char\\);\r\nchar BBB::CCC::xyzq\\(char\\);\r\nchar BBB::Class::xyzq\\(char\\);\r\n$gdb_prompt $" {
122
       pass "info func xyzq"
123
   }
124
   -re ".*$gdb_prompt $" { fail "info func xyzq" }
125
   timeout { fail "(timeout) info func xyzq" }
126
}
127
 
128
# Call a function in a namespace
129
 
130
send_gdb "print 'AAA::xyzq'('x')\n"
131
gdb_expect {
132
   -re "\\$\[0-9\]* = 97 'a'\r\n$gdb_prompt $" {
133
       pass "print 'AAA::xyzq'('x')"
134
   }
135
   -re ".*$gdb_prompt $" { fail "print 'AAA::xyzq'('x')" }
136
   timeout { fail "(timeout) print 'AAA::xyzq'('x')" }
137
}
138
 
139
# Break on a function in a namespace
140
 
141
send_gdb "break AAA::xyzq\n"
142
gdb_expect {
143
    -re "Breakpoint.*at $hex: file.*namespace.cc, line 42\\.\r\n$gdb_prompt $" {
144
         pass "break AAA::xyzq"
145
    }
146
   -re ".*$gdb_prompt $" { fail "break AAA::xyzq" }
147
   timeout { fail "(timeout) break AAA::xyzq" }
148
}
149
 
150
# Call a function in a nested namespace
151
 
152
send_gdb "print 'BBB::CCC::xyzq'('x')\n"
153
gdb_expect {
154
   -re "\\$\[0-9\]* = 122 'z'\r\n$gdb_prompt $" {
155
       pass "print 'BBB::CCC::xyzq'('x')"
156
   }
157
   -re ".*$gdb_prompt $" { fail "print 'BBB::CCC::xyzq'('x')" }
158
   timeout { fail "(timeout) print 'BBB::CCC::xyzq'('x')" }
159
}
160
 
161
# Break on a function in a nested namespace
162
 
163
send_gdb "break BBB::CCC::xyzq\n"
164
gdb_expect {
165
    -re "Breakpoint.*at $hex: file.*namespace.cc, line 58\\.\r\n$gdb_prompt $" {
166
         pass "break BBB::CCC::xyzq"
167
    }
168
   -re ".*$gdb_prompt $" { fail "break BBB::CCC::xyzq" }
169
   timeout { fail "(timeout) break BBB::CCC::xyzq" }
170
}
171
 
172
# Print address of a function in a class in a namespace
173
 
174
send_gdb "print 'BBB::Class'::xyzq\n"
175
gdb_expect {
176
   -re "\\$\[0-9\]* = \{char \\(BBB::Class \\*, char\\)\} $hex \r\n$gdb_prompt $" {
177
       pass "print 'BBB::Class'::xyzq"
178
   }
179
   -re ".*$gdb_prompt $" { fail "print 'BBB::Class'::xyzq" }
180
   timeout { fail "(timeout) print 'BBB::Class'::xyzq" }
181
}
182
 
183
# Break on a function in a class in a namespace
184
 
185
send_gdb "break BBB::Class::xyzq\n"
186
gdb_expect {
187
    -re "Breakpoint.*at $hex: file.*namespace.cc, line 63\\.\r\n$gdb_prompt $" {
188
         pass "break BBB::Class::xyzq"
189
    }
190
   -re ".*$gdb_prompt $" { fail "break BBB::Class::xyzq" }
191
   timeout { fail "(timeout) break BBB::Class::xyzq" }
192
}
193
 

powered by: WebSVN 2.1.0

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