This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[rfa] always use demangled name to set scope
- From: David Carlton <carlton at kealia dot com>
- To: gdb-patches at sources dot redhat dot com
- Cc: Daniel Jacobowitz <drow at mvista dot com>
- Date: Thu, 12 Jun 2003 15:26:34 -0700
- Subject: [rfa] always use demangled name to set scope
As per recent discussions, it seems likely that the variable
'processing_current_namespace' isn't always valid: if a function is
declared in a namespace but defined outside the body of that
namespace, then probably sometimes dwarf2read.c won't notice that,
because of a DW_AT_specification tag, the current namespace is
different from what is given by the immediate hierarchical structure.
I'm trying to sort this out on my branch, but I think I'd prefer a
less intrusive fix on the mainline, since we're about to branch for
GDB 6.0. Fortunately, the mainline currently only uses that variable
in once place, namely cp_set_block_scope. And, in that situation, it
has the fallback strategy of looking at the demangled name.
So this patch tells GDB to just always use that fallback strategy for
now. It should work fine in the short term; we can get this all
straightened out fully for 6.1, as part of merging in the rest of my
branch (in particular nested types support).
Tested on GCC 3.2, DWARF 2, i686-pc-linux-gnu; no new regressions. I
also ran gdb.c++/namespace.exp with a version of GCC patched to
generated DW_TAG_namespace entries, and I didn't get any regressions
there, either. OK to commit?
David Carlton
carlton@kealia.com
2003-06-12 David Carlton <carlton@kealia.com>
* cp-namespace.c (cp_set_block_scope): Comment out
processing_has_namespace_info branch.
Index: cp-namespace.c
===================================================================
RCS file: /cvs/src/src/gdb/cp-namespace.c,v
retrieving revision 1.2
diff -u -p -r1.2 cp-namespace.c
--- cp-namespace.c 20 May 2003 03:56:28 -0000 1.2
+++ cp-namespace.c 12 Jun 2003 22:17:47 -0000
@@ -38,6 +38,9 @@ unsigned char processing_has_namespace_i
contain the name of the current namespace. The string is
temporary; copy it if you need it. */
+/* FIXME: carlton/2003-06-12: This isn't entirely reliable: currently,
+ we get mislead by DW_AT_specification. */
+
const char *processing_current_namespace;
/* List of using directives that are active in the current file. */
@@ -187,6 +190,12 @@ cp_set_block_scope (const struct symbol
if (SYMBOL_CPLUS_DEMANGLED_NAME (symbol) != NULL)
{
+#if 0
+ /* FIXME: carlton/2003-06-12: As mentioned above,
+ 'processing_has_namespace_info' currently isn't entirely
+ reliable, so let's always use demangled names to get this
+ information for now. */
+
if (processing_has_namespace_info)
{
block_set_scope
@@ -196,6 +205,7 @@ cp_set_block_scope (const struct symbol
obstack);
}
else
+#endif
{
/* Try to figure out the appropriate namespace from the
demangled name. */