b368761e45
Partial workaround for PR c++/1511: * cp-namespace.c: Include frame.h. (cp_lookup_transparent_type): New (cp_lookup_transparent_type_loop): New. * cp-support.h: Declare cp_lookup_transparent_type. * symtab.c (basic_lookup_transparent_type): Renamed from lookup_transparent_type. (lookup_transparent_type): Replace old body by a call to current_language->la_lookup_transparent_type. * symtab.h: Update copyright. Declare basic_lookup_transparent_type. * language.h: Update copyright. (struct language_defn): Add la_lookup_transparent_type. * language.c: Update copyright. (unknown_language_defn): Add basic_lookup_transparent_type. (auto_language_defn): Add basic_lookup_transparent_type. (local_language_defn): Add basic_lookup_transparent_type. * ada-lang.c: Update copyright. (ada_language_defn): Add basic_lookup_transparent_type. * c-lang.c: Update copyright. (c_language_defn): Add basic_lookup_transparent_type. (cplus_language_defn): Add basic_lookup_transparent_type. (asm_language_defn): Add basic_lookup_transparent_type. (minimal_language_defn): Add basic_lookup_transparent_type. * f-lang.c: Update copyright. (f_language_defn): Add basic_lookup_transparent_type. * jv-lang.c: Update copyright. (java_language_defn): Add basic_lookup_transparent_type. * m2-lang.c: Update copyright. (m2_language_defn): Add basic_lookup_transparent_type. * objc-lang.c: Update copyright. (objc_language_defn): Add basic_lookup_transparent_type. * p-lang.c: Update copyright. (p_language_defn): Add basic_lookup_transparent_type. * scm-lang.c: Update copyright. (scm_language_defn): Add basic_lookup_transparent_type. * Makefile.in (cp-namespace.o): Depend on frame.h. 2004-01-23 David Carlton <carlton@kealia.com> * gdb.cp/rtti.exp: Don't include full path in ${srcfile}. Add test for cp_lookup_transparent_type. * gdb.cp/rtti1.cc: Update copyright. Add n2::func and refer_to; call them.
144 lines
4.9 KiB
Text
144 lines
4.9 KiB
Text
# Copyright 2003, 2004 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
# This file is part of the gdb testsuite.
|
|
|
|
# This contains tests for GDB's use of RTTI information. This stems
|
|
# from a bug reported in PR gdb/488 and other places, which leads to
|
|
# statements like 'warning: can't find class named 'C::D', as given by
|
|
# C++ RTTI'. It arises from GDB not knowing about classes that are
|
|
# defined in namespaces.
|
|
|
|
# NOTE: carlton/2003-05-16: I suspect it could arise from nested class
|
|
# issues, too, and even once we fix that, there might be situations
|
|
# (involving templates, in particular) where this problem triggers
|
|
# because GDB and GCC have different ideas what a class is called.
|
|
|
|
if $tracelevel then {
|
|
strace $tracelevel
|
|
}
|
|
|
|
if { [skip_cplus_tests] } { continue }
|
|
|
|
#
|
|
# test running programs
|
|
#
|
|
set prms_id 0
|
|
set bug_id 0
|
|
|
|
set testfile "rtti"
|
|
set srcfile1 "${srcdir}/${subdir}/${testfile}1.cc"
|
|
set objfile1 "${objdir}/${subdir}/${testfile}1.o"
|
|
set srcfile2 "${srcdir}/${subdir}/${testfile}2.cc"
|
|
set objfile2 "${objdir}/${subdir}/${testfile}2.o"
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
|
|
|
# gdb_get_line_number needs this to be called srcfile. Except that it
|
|
# gets confused if the directories are included. :-(
|
|
set srcfile "${testfile}1.cc"
|
|
|
|
if { [gdb_compile "${srcfile1}" "${objfile1}" object {debug c++}] != "" } {
|
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
|
}
|
|
|
|
if { [gdb_compile "${srcfile2}" "${objfile2}" object {debug c++}] != "" } {
|
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
|
}
|
|
|
|
if { [gdb_compile "${objfile1} ${objfile2}" "${binfile}" executable {debug c++}] != "" } {
|
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
|
}
|
|
|
|
if [get_compiler_info ${binfile} "c++"] {
|
|
return -1
|
|
}
|
|
|
|
gdb_exit
|
|
gdb_start
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
gdb_load ${binfile}
|
|
|
|
|
|
if ![runto_main] then {
|
|
perror "couldn't run to breakpoint"
|
|
continue
|
|
}
|
|
|
|
# First, run to after we've constructed the object:
|
|
|
|
gdb_breakpoint [gdb_get_line_number "main-constructs-done"]
|
|
gdb_continue_to_breakpoint "end of constructors in main"
|
|
|
|
gdb_test_multiple "print *e1" "print *e1" {
|
|
-re "warning: RTTI symbol not found for class 'n1::D1'.*$gdb_prompt $" {
|
|
# gdb HEAD 2003-12-05
|
|
kfail "gdb/488" "print *e1"
|
|
}
|
|
-re "warning: can't find class named `n1::D1', as given by C\\+\\+ RTTI.*$gdb_prompt $" {
|
|
# gdb 6.0
|
|
kfail "gdb/488" "print *e1"
|
|
}
|
|
-re "\\$\[0-9\]* = {<n1::Base1> = .*}\r\n$gdb_prompt $" {
|
|
pass "print *e1"
|
|
}
|
|
-re "\\$\[0-9\]* = {<Base1> = .*}\r\n$gdb_prompt $" {
|
|
# NOTE: carlton/2003-05-16: If code is compiled by GCC2, we
|
|
# don't print the warning (for no particular reason), but we
|
|
# still call the class via the wrong name; PR gdb/57 is our
|
|
# catch-all PR for nested type problems.
|
|
kfail "gdb/57" "print *e1"
|
|
}
|
|
}
|
|
|
|
# NOTE: carlton/2004-01-14: This test with an "<incomplete type>"
|
|
# message because, within rtt1.cc, GDB has no way of knowing that the
|
|
# class is called 'n2::D2' instead of just 'D2'. This is an artifical
|
|
# test case, though: if we were using these classes in a more
|
|
# substantial way, G++ would emit more debug info. As is, I don't
|
|
# think there's anything that GDB can do about this case until G++
|
|
# starts emitting DW_TAG_namespace info; this should arrive with GCC
|
|
# 3.4.
|
|
|
|
gdb_test_multiple "print *e2" "print *e2" {
|
|
-re "warning: RTTI symbol not found for class 'n2::D2'.*$gdb_prompt $" {
|
|
# gdb HEAD 2003-12-05
|
|
kfail "gdb/488" "print *e2"
|
|
}
|
|
-re "warning: can't find class named `n2::D2', as given by C\\+\\+ RTTI.*$gdb_prompt $" {
|
|
# gdb 6.0
|
|
kfail "gdb/488" "print *e2"
|
|
}
|
|
-re "\\$\[0-9\]* = <incomplete type>\r\n$gdb_prompt $" {
|
|
kfail "gdb/1511" "print *e2"
|
|
}
|
|
-re "\\$\[0-9\]* = {<n2::Base2> = .*}\r\n$gdb_prompt $" {
|
|
pass "print *e2"
|
|
}
|
|
-re "\\$\[0-9\]* = {<Base2> = .*}\r\n$gdb_prompt $" {
|
|
kfail "gdb/57" "print *e2"
|
|
}
|
|
}
|
|
|
|
# Now we test the hack that's been implemented to get around some
|
|
# instances of PR gdb/1511.
|
|
|
|
gdb_breakpoint [gdb_get_line_number "func-constructs-done"]
|
|
gdb_continue_to_breakpoint "end of constructors in func"
|
|
|
|
gdb_test "print *obj" "\\$\[0-9\]* = {<n2::Base2> = .*}"
|
|
|
|
gdb_exit
|
|
return 0
|