aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlton <carlton@bactrian.org>2004-01-23 23:03:31 +0000
committerDavid Carlton <carlton@bactrian.org>2004-01-23 23:03:31 +0000
commitb368761e45fa3e27c8433fa421963d6ecf12c34a (patch)
treef65d813953407f95d929af3f87862822aafe796a
parent3835ff9bee0c43850d7d25b7dd6b36d2e3e562d9 (diff)
downloadgdb-b368761e45fa3e27c8433fa421963d6ecf12c34a.zip
gdb-b368761e45fa3e27c8433fa421963d6ecf12c34a.tar.gz
gdb-b368761e45fa3e27c8433fa421963d6ecf12c34a.tar.bz2
2004-01-23 David Carlton <carlton@kealia.com>
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.
-rw-r--r--gdb/ChangeLog40
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/ada-lang.c3
-rw-r--r--gdb/c-lang.c6
-rw-r--r--gdb/cp-namespace.c73
-rw-r--r--gdb/cp-support.h2
-rw-r--r--gdb/f-lang.c3
-rw-r--r--gdb/jv-lang.c3
-rw-r--r--gdb/language.c5
-rw-r--r--gdb/language.h7
-rw-r--r--gdb/m2-lang.c3
-rw-r--r--gdb/objc-lang.c3
-rw-r--r--gdb/p-lang.c3
-rw-r--r--gdb/scm-lang.c3
-rw-r--r--gdb/symtab.c20
-rw-r--r--gdb/symtab.h3
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.cp/rtti.exp17
-rw-r--r--gdb/testsuite/gdb.cp/rtti1.cc26
19 files changed, 204 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d6a8b62..fb8f036 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,45 @@
2004-01-23 David Carlton <carlton@kealia.com>
+ 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>
+
Patch for PR c++/1520:
* dwarf2read.c (read_func_scope): Set processing_current_prefix
properly if we have a specification die.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index a4e4c47..0affd35 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1691,7 +1691,7 @@ cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) $(gdbcmd_h) \
$(ui_out_h) $(gdb_string_h)
cp-namespace.o: cp-namespace.c $(defs_h) $(cp_support_h) $(gdb_obstack_h) \
$(symtab_h) $(symfile_h) $(gdb_assert_h) $(block_h) $(objfiles_h) \
- $(gdbtypes_h) $(dictionary_h) $(command_h)
+ $(gdbtypes_h) $(dictionary_h) $(command_h) $(frame_h)
cp-support.o: cp-support.c $(defs_h) $(cp_support_h) $(gdb_string_h) \
$(demangle_h) $(gdb_assert_h) $(gdbcmd_h) $(dictionary_h) \
$(objfiles_h) $(frame_h) $(symtab_h) $(block_h) $(complaints_h) \
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index f05585f..b97321b 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1,5 +1,5 @@
/* Ada language support routines for GDB, the GNU debugger. Copyright
- 1992, 1993, 1994, 1997, 1998, 1999, 2000, 2003
+ 1992, 1993, 1994, 1997, 1998, 1999, 2000, 2003, 2004
Free Software Foundation, Inc.
This file is part of GDB.
@@ -8019,6 +8019,7 @@ const struct language_defn ada_language_defn = {
NULL, /* Language specific skip_trampoline */
value_of_this, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
#if 0
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index a296d81..ba34540 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -1,5 +1,5 @@
/* C language support routines for GDB, the GNU debugger.
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002
+ Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of GDB.
@@ -556,6 +556,7 @@ const struct language_defn c_language_defn =
NULL, /* Language specific skip_trampoline */
NULL, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
@@ -613,6 +614,7 @@ const struct language_defn cplus_language_defn =
NULL, /* Language specific skip_trampoline */
value_of_this, /* value_of_this */
cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ cp_lookup_transparent_type, /* lookup_transparent_type */
cplus_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
@@ -647,6 +649,7 @@ const struct language_defn asm_language_defn =
NULL, /* Language specific skip_trampoline */
NULL, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
@@ -686,6 +689,7 @@ const struct language_defn minimal_language_defn =
NULL, /* Language specific skip_trampoline */
NULL, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index fed440e..b9cc794 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -31,6 +31,7 @@
#include "gdbtypes.h"
#include "dictionary.h"
#include "command.h"
+#include "frame.h"
/* When set, the file that we're processing is known to have debugging
info for C++ namespaces. */
@@ -85,6 +86,10 @@ static struct symbol *lookup_symbol_file (const char *name,
struct symtab **symtab,
int anonymous_namespace);
+static struct type *cp_lookup_transparent_type_loop (const char *name,
+ const char *scope,
+ int scope_len);
+
static void initialize_namespace_symtab (struct objfile *objfile);
static struct block *get_possible_namespace_block (struct objfile *objfile);
@@ -551,6 +556,74 @@ cp_lookup_nested_type (struct type *parent_type,
}
}
+/* The C++-version of lookup_transparent_type. */
+
+/* FIXME: carlton/2004-01-16: The problem that this is trying to
+ address is that, unfortunately, sometimes NAME is wrong: it may not
+ include the name of namespaces enclosing the type in question.
+ lookup_transparent_type gets called when the the type in question
+ is a declaration, and we're trying to find its definition; but, for
+ declarations, our type name deduction mechanism doesn't work.
+ There's nothing we can do to fix this in general, I think, in the
+ absence of debug information about namespaces (I've filed PR
+ gdb/1511 about this); until such debug information becomes more
+ prevalent, one heuristic which sometimes looks is to search for the
+ definition in namespaces containing the current namespace.
+
+ We should delete this functions once the appropriate debug
+ information becomes more widespread. (GCC 3.4 will be the first
+ released version of GCC with such information.) */
+
+struct type *
+cp_lookup_transparent_type (const char *name)
+{
+ /* First, try the honest way of looking up the definition. */
+ struct type *t = basic_lookup_transparent_type (name);
+ const char *scope;
+
+ if (t != NULL)
+ return t;
+
+ /* If that doesn't work and we're within a namespace, look there
+ instead. */
+ scope = block_scope (get_selected_block (0));
+
+ if (scope[0] == '\0')
+ return NULL;
+
+ return cp_lookup_transparent_type_loop (name, scope, 0);
+}
+
+/* Lookup the the type definition associated to NAME in
+ namespaces/classes containing SCOPE whose name is strictly longer
+ than LENGTH. LENGTH must be the index of the start of a
+ component of SCOPE. */
+
+static struct type *
+cp_lookup_transparent_type_loop (const char *name, const char *scope,
+ int length)
+{
+ int scope_length = cp_find_first_component (scope + length);
+ char *full_name;
+
+ /* If the current scope is followed by "::", look in the next
+ component. */
+ if (scope[scope_length] == ':')
+ {
+ struct type *retval
+ = cp_lookup_transparent_type_loop (name, scope, scope_length + 2);
+ if (retval != NULL)
+ return retval;
+ }
+
+ full_name = alloca (scope_length + 2 + strlen (name) + 1);
+ strncpy (full_name, scope, scope_length);
+ strncpy (full_name + scope_length, "::", 2);
+ strcpy (full_name + scope_length + 2, name);
+
+ return basic_lookup_transparent_type (full_name);
+}
+
/* Now come functions for dealing with symbols associated to
namespaces. (They're used to store the namespaces themselves, not
objects that live in the namespaces.) These symbols come in two
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index d4785c3..49da26c 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -108,6 +108,8 @@ extern struct type *cp_lookup_nested_type (struct type *parent_type,
extern void cp_check_possible_namespace_symbols (const char *name,
struct objfile *objfile);
+struct type *cp_lookup_transparent_type (const char *name);
+
/* The list of "maint cplus" commands. */
extern struct cmd_list_element *maint_cplus_cmd_list;
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 37ca92c..c34b4a7 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -1,5 +1,5 @@
/* Fortran language support routines for GDB, the GNU debugger.
- Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+ Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Contributed by Motorola. Adapted from the C parser by Farooq Butt
(fmbutt@engage.sps.mot.com).
@@ -475,6 +475,7 @@ const struct language_defn f_language_defn =
NULL, /* Language specific skip_trampoline */
value_of_this, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%o", "0", "o", ""}, /* Octal format info */
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index d4779fd..92c263b 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -1,5 +1,5 @@
/* Java language support routines for GDB, the GNU debugger.
- Copyright 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1046,6 +1046,7 @@ const struct language_defn java_language_defn =
NULL, /* Language specific skip_trampoline */
value_of_this, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
java_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
diff --git a/gdb/language.c b/gdb/language.c
index 3be9f9e..bc00b47 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -1,7 +1,7 @@
/* Multiple source language support for GDB.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
- 2001, 2002, 2003 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by the Department of Computer Science at the State University
of New York at Buffalo.
@@ -1289,6 +1289,7 @@ const struct language_defn unknown_language_defn =
unk_lang_trampoline, /* Language specific skip_trampoline */
value_of_this, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
@@ -1324,6 +1325,7 @@ const struct language_defn auto_language_defn =
unk_lang_trampoline, /* Language specific skip_trampoline */
value_of_this, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
@@ -1358,6 +1360,7 @@ const struct language_defn local_language_defn =
unk_lang_trampoline, /* Language specific skip_trampoline */
value_of_this, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
diff --git a/gdb/language.h b/gdb/language.h
index 7470167..8ed9fb0 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -1,7 +1,7 @@
/* Source-language-related definitions for GDB.
- Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2003 Free
- Software Foundation, Inc.
+ Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2003,
+ 2004 Free Software Foundation, Inc.
Contributed by the Department of Computer Science at the State University
of New York at Buffalo.
@@ -233,6 +233,9 @@ struct language_defn
const domain_enum,
struct symtab **);
+ /* Find the definition of the type with the given name. */
+ struct type *(*la_lookup_transparent_type) (const char *);
+
/* Return demangled language symbol, or NULL. */
char *(*la_demangle) (const char *mangled, int options);
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 7fe2e34e..e5b6b50 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -1,5 +1,5 @@
/* Modula 2 language support routines for GDB, the GNU debugger.
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2002
+ Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of GDB.
@@ -428,6 +428,7 @@ const struct language_defn m2_language_defn =
NULL, /* Language specific skip_trampoline */
value_of_this, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"%loB", "", "o", "B"}, /* Octal format info */
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index c655616..cc933db 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -1,6 +1,6 @@
/* Objective-C language support routines for GDB, the GNU debugger.
- Copyright 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Apple Computer, Inc.
Written by Michael Snyder.
@@ -672,6 +672,7 @@ const struct language_defn objc_language_defn = {
objc_skip_trampoline, /* Language specific skip_trampoline */
value_of_this, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
objc_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 3ebb433..a402532 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -1,5 +1,5 @@
/* Pascal language support routines for GDB, the GNU debugger.
- Copyright 2000, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
@@ -464,6 +464,7 @@ const struct language_defn pascal_language_defn =
NULL, /* Language specific skip_trampoline */
value_of_this, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
NULL, /* Language specific symbol demangler */
{"", "%", "b", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c
index 7e2ad8f..872dcaf 100644
--- a/gdb/scm-lang.c
+++ b/gdb/scm-lang.c
@@ -1,6 +1,6 @@
/* Scheme/Guile language support routines for GDB, the GNU debugger.
- Copyright 1995, 1996, 1998, 2000, 2001, 2002, 2003 Free Software
+ Copyright 1995, 1996, 1998, 2000, 2001, 2002, 2003, 2004 Free Software
Foundation, Inc.
This file is part of GDB.
@@ -263,6 +263,7 @@ const struct language_defn scm_language_defn =
NULL, /* Language specific skip_trampoline */
value_of_this, /* value_of_this */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
+ basic_lookup_transparent_type,/* lookup_transparent_type */
NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"#o%lo", "#o", "o", ""}, /* Octal format info */
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 1d7b396..fa8b3e7 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1,7 +1,7 @@
/* Symbol table lookup for the GNU debugger, GDB.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
- 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of GDB.
@@ -1480,15 +1480,23 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name,
}
/* Look up a type named NAME in the struct_domain. The type returned
- must not be opaque -- i.e., must have at least one field defined
+ must not be opaque -- i.e., must have at least one field
+ defined. */
- This code was modelled on lookup_symbol -- the parts not relevant to looking
- up types were just left out. In particular it's assumed here that types
- are available in struct_domain and only at file-static or global blocks. */
+struct type *
+lookup_transparent_type (const char *name)
+{
+ return current_language->la_lookup_transparent_type (name);
+}
+/* The standard implementation of lookup_transparent_type. This code
+ was modeled on lookup_symbol -- the parts not relevant to looking
+ up types were just left out. In particular it's assumed here that
+ types are available in struct_domain and only at file-static or
+ global blocks. */
struct type *
-lookup_transparent_type (const char *name)
+basic_lookup_transparent_type (const char *name)
{
struct symbol *sym;
struct symtab *s = NULL;
diff --git a/gdb/symtab.h b/gdb/symtab.h
index ce1c9fa..95813bd 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1,7 +1,7 @@
/* Symbol table definitions for GDB.
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+ 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
Foundation, Inc.
This file is part of GDB.
@@ -1107,6 +1107,7 @@ extern int find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *);
extern void reread_symbols (void);
extern struct type *lookup_transparent_type (const char *);
+extern struct type *basic_lookup_transparent_type (const char *);
/* Macro for name of symbol to indicate a file compiled with gcc. */
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 398255a..53a6687 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
2004-01-23 Daniel Jacobowitz <drow@mvista.com>
* gdb.mi/mi-var-child.exp: Update copyright year. Move new test
diff --git a/gdb/testsuite/gdb.cp/rtti.exp b/gdb/testsuite/gdb.cp/rtti.exp
index 1241665..0a8a2d7 100644
--- a/gdb/testsuite/gdb.cp/rtti.exp
+++ b/gdb/testsuite/gdb.cp/rtti.exp
@@ -46,8 +46,9 @@ 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.
-set srcfile "${srcfile1}"
+# 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."
@@ -78,8 +79,8 @@ if ![runto_main] then {
# First, run to after we've constructed the object:
-gdb_breakpoint [gdb_get_line_number "constructs-done"]
-gdb_continue_to_breakpoint "end of constructors"
+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 $" {
@@ -131,5 +132,13 @@ gdb_test_multiple "print *e2" "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
diff --git a/gdb/testsuite/gdb.cp/rtti1.cc b/gdb/testsuite/gdb.cp/rtti1.cc
index 6e9d862..de8e12f 100644
--- a/gdb/testsuite/gdb.cp/rtti1.cc
+++ b/gdb/testsuite/gdb.cp/rtti1.cc
@@ -1,6 +1,6 @@
/* Code to go along with tests in rtti.exp.
- Copyright 2003 Free Software Foundation, Inc.
+ Copyright 2003, 2004 Free Software Foundation, Inc.
Contributed by David Carlton <carlton@bactrian.org> and by Kealia,
Inc.
@@ -55,6 +55,26 @@ namespace n1 {
} // n1
+// NOTE: carlton/2004-01-23: This call exists only to convince GCC to
+// keep around a reference to 'obj' in n2::func - GCC 3.4 had been
+// optimizing it away.
+void refer_to (n2::C2 *obj)
+{
+ // Do nothing.
+}
+
+namespace n2
+{
+ void func ()
+ {
+ C2 *obj = create2 ();
+
+ refer_to (obj); // func-constructs-done
+
+ return;
+ }
+}
+
int main()
{
using namespace n1;
@@ -63,5 +83,7 @@ int main()
C1 *e1 = create1();
C2 *e2 = create2();
- return 0; // constructs-done
+ n2::func(); // main-constructs-done
+
+ return 0;
}