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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.cp/] [rtti.exp] - Blame information for rev 842

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 2003, 2004, 2007, 2008, 2009, 2010 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
# This file is part of the gdb testsuite.
17
 
18
# This contains tests for GDB's use of RTTI information.  This stems
19
# from a bug reported in PR gdb/488 and other places, which leads to
20
# statements like 'warning: can't find class named 'C::D', as given by
21
# C++ RTTI'.  It arises from GDB not knowing about classes that are
22
# defined in namespaces.
23
 
24
# NOTE: carlton/2003-05-16: I suspect it could arise from nested class
25
# issues, too, and even once we fix that, there might be situations
26
# (involving templates, in particular) where this problem triggers
27
# because GDB and GCC have different ideas what a class is called.
28
 
29
if $tracelevel then {
30
        strace $tracelevel
31
        }
32
 
33
if { [skip_cplus_tests] } { continue }
34
 
35
#
36
# test running programs
37
#
38
set prms_id 0
39
set bug_id 0
40
 
41
set testfile "rtti"
42
set srcfile1 "${testfile}1.cc"
43
set objfile1 "${testfile}1.o"
44
set srcfile2 "${testfile}2.cc"
45
set objfile2 "${testfile}2.o"
46
set binfile  "${objdir}/${subdir}/${testfile}"
47
 
48
if  { [gdb_compile "$srcdir/$subdir/$srcfile1" "$objdir/$subdir/$objfile1" object {debug c++}] != "" } {
49
     untested rtti.exp
50
     return -1
51
}
52
 
53
if  { [gdb_compile "$srcdir/$subdir/$srcfile2" "$objdir/$subdir/$objfile2" object {debug c++}] != "" } {
54
     untested rtti.exp
55
     return -1
56
}
57
 
58
if  { [gdb_compile "$objdir/$subdir/$objfile1 $objdir/$subdir/$objfile2" "${binfile}" executable {debug c++}] != "" } {
59
     untested rtti.exp
60
     return -1
61
}
62
 
63
if [get_compiler_info ${binfile} "c++"] {
64
    return -1
65
}
66
 
67
gdb_exit
68
gdb_start
69
gdb_reinitialize_dir $srcdir/$subdir
70
gdb_load ${binfile}
71
 
72
 
73
if ![runto_main] then {
74
    perror "couldn't run to breakpoint"
75
    continue
76
}
77
 
78
# First, run to after we've constructed the object:
79
 
80
gdb_breakpoint [gdb_get_line_number "main-constructs-done" "$srcfile1"]
81
gdb_continue_to_breakpoint "end of constructors in main"
82
 
83
gdb_test_multiple "print *e1" "print *e1" {
84
    -re "warning: RTTI symbol not found for class 'n1::D1'.*$gdb_prompt $" {
85
        # gdb HEAD 2003-12-05
86
        kfail "gdb/488" "print *e1"
87
    }
88
    -re "warning: can't find class named `n1::D1', as given by C\\+\\+ RTTI.*$gdb_prompt $" {
89
        # gdb 6.0
90
        kfail "gdb/488" "print *e1"
91
    }
92
    -re "\\$\[0-9\]* = { = .*}\r\n$gdb_prompt $" {
93
        pass "print *e1"
94
    }
95
    -re "\\$\[0-9\]* = { = .*}\r\n$gdb_prompt $" {
96
        # NOTE: carlton/2003-05-16: If code is compiled by GCC2, we
97
        # don't print the warning (for no particular reason), but we
98
        # still call the class via the wrong name; PR gdb/57 is our
99
        # catch-all PR for nested type problems.
100
        kfail "gdb/57" "print *e1"
101
    }
102
}
103
 
104
# NOTE: carlton/2004-01-14: This test with an ""
105
# message because, within rtt1.cc, GDB has no way of knowing that the
106
# class is called 'n2::D2' instead of just 'D2'.  This is an artifical
107
# test case, though: if we were using these classes in a more
108
# substantial way, G++ would emit more debug info.  As is, I don't
109
# think there's anything that GDB can do about this case until G++
110
# starts emitting DW_TAG_namespace info; this should arrive with GCC
111
# 3.4.
112
 
113
gdb_test_multiple "print *e2" "print *e2" {
114
    -re "warning: RTTI symbol not found for class 'n2::D2'.*$gdb_prompt $" {
115
        # gdb HEAD 2003-12-05
116
        kfail "gdb/488" "print *e2"
117
    }
118
    -re "warning: can't find class named `n2::D2', as given by C\\+\\+ RTTI.*$gdb_prompt $" {
119
        # gdb 6.0
120
        kfail "gdb/488" "print *e2"
121
    }
122
    -re "\\$\[0-9\]* = \r\n$gdb_prompt $" {
123
        kfail "gdb/1511" "print *e2"
124
    }
125
    -re "\\$\[0-9\]* = { = .*}\r\n$gdb_prompt $" {
126
        pass "print *e2"
127
    }
128
    -re "\\$\[0-9\]* = { = .*}\r\n$gdb_prompt $" {
129
        kfail "gdb/57" "print *e2"
130
    }
131
}
132
 
133
# Now we test the hack that's been implemented to get around some
134
# instances of PR gdb/1511.
135
 
136
gdb_breakpoint [gdb_get_line_number "func-constructs-done" "$srcfile1"]
137
gdb_continue_to_breakpoint "end of constructors in func"
138
 
139
gdb_test "print *obj" "\\$\[0-9\]* = { = .*}"
140
 
141
gdb_breakpoint [gdb_get_line_number "func3-constructs-done" "$srcfile1"]
142
gdb_continue_to_breakpoint "end of constructors in func3"
143
 
144
gdb_test "print *obj3" "\\$\[0-9\]* = { = .*}"
145
 
146
gdb_exit
147
return 0

powered by: WebSVN 2.1.0

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