* [rfa] always use demangled name to set scope
@ 2003-06-12 22:26 David Carlton
2003-06-12 23:18 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: David Carlton @ 2003-06-12 22:26 UTC (permalink / raw)
To: gdb-patches; +Cc: Daniel Jacobowitz
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. */
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [rfa] always use demangled name to set scope
2003-06-12 22:26 [rfa] always use demangled name to set scope David Carlton
@ 2003-06-12 23:18 ` Daniel Jacobowitz
2003-06-13 1:01 ` David Carlton
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2003-06-12 23:18 UTC (permalink / raw)
To: David Carlton; +Cc: gdb-patches
On Thu, Jun 12, 2003 at 03:26:34PM -0700, David Carlton wrote:
> 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?
Yes. By 6.1 I want to rip out all uses of the demangled name along the
DWARF-2 code path though. If I can find the time...
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [rfa] always use demangled name to set scope
2003-06-12 23:18 ` Daniel Jacobowitz
@ 2003-06-13 1:01 ` David Carlton
2003-06-13 4:22 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: David Carlton @ 2003-06-13 1:01 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
On Thu, 12 Jun 2003 19:17:27 -0400, Daniel Jacobowitz <drow@mvista.com> said:
> On Thu, Jun 12, 2003 at 03:26:34PM -0700, David Carlton wrote:
>> OK to commit?
> Yes.
Thanks, committed.
> By 6.1 I want to rip out all uses of the demangled name along the
> DWARF-2 code path though. If I can find the time...
We'll see. I do think that the nested type deduction machinery is
both useful and impossible to do without demangled names. And there
are fun bits like how gnuv3_rtti_type looks at the demangled name of
the vtable. If it were possible to get rid of that, I would be a
happy person indeed, since its existence is probably going to force me
to change the demangler's output somewhat. (On the other hand, that
call is also a useful canary in the coal mine, too, because of the
RTTI warning that comes out of it.)
But I really am getting a pretty good feel for how to use the
hierarchical info in DWARF to help us here. And people at Kealia have
given me some very useful bug reports along those lines: this would be
impossible to get at all right without a large C++ code base to
trigger all sorts of random GCC idiosyncracies.
David Carlton
carlton@math.stanford.edu
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [rfa] always use demangled name to set scope
2003-06-13 1:01 ` David Carlton
@ 2003-06-13 4:22 ` Daniel Jacobowitz
2003-06-13 4:28 ` David Carlton
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2003-06-13 4:22 UTC (permalink / raw)
To: David Carlton; +Cc: gdb-patches
On Thu, Jun 12, 2003 at 06:01:28PM -0700, David Carlton wrote:
> On Thu, 12 Jun 2003 19:17:27 -0400, Daniel Jacobowitz <drow@mvista.com> said:
> > On Thu, Jun 12, 2003 at 03:26:34PM -0700, David Carlton wrote:
>
> >> OK to commit?
>
> > Yes.
>
> Thanks, committed.
>
> > By 6.1 I want to rip out all uses of the demangled name along the
> > DWARF-2 code path though. If I can find the time...
>
> We'll see. I do think that the nested type deduction machinery is
> both useful and impossible to do without demangled names. And there
I completely disagree. We have all the machinery in DWARF-2 to do it
without demangled names by using the available hierarchy; it was
designed to suffice for this.
Stabs we'll just have to fake it.
> are fun bits like how gnuv3_rtti_type looks at the demangled name of
> the vtable. If it were possible to get rid of that, I would be a
> happy person indeed, since its existence is probably going to force me
> to change the demangler's output somewhat. (On the other hand, that
> call is also a useful canary in the coal mine, too, because of the
> RTTI warning that comes out of it.)
I am fairly sure we can kill that for DWARF-2 at least. I'd rather
kill it than change the demangler.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [rfa] always use demangled name to set scope
2003-06-13 4:22 ` Daniel Jacobowitz
@ 2003-06-13 4:28 ` David Carlton
2003-06-13 4:38 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: David Carlton @ 2003-06-13 4:28 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
On Fri, 13 Jun 2003 00:22:14 -0400, Daniel Jacobowitz <drow@mvista.com> said:
> On Thu, Jun 12, 2003 at 06:01:28PM -0700, David Carlton wrote:
>> On Thu, 12 Jun 2003 19:17:27 -0400, Daniel Jacobowitz <drow@mvista.com> said:
>> > By 6.1 I want to rip out all uses of the demangled name along the
>> > DWARF-2 code path though. If I can find the time...
>>
>> We'll see. I do think that the nested type deduction machinery is
>> both useful and impossible to do without demangled names. And there
> I completely disagree. We have all the machinery in DWARF-2 to do it
> without demangled names by using the available hierarchy; it was
> designed to suffice for this.
Yeah, but we need DW_TAG_namespace to do it, and a version of GCC
providing that probably won't be released until next calendar year. I
certainly don't use demangled names to do nested type deduction if we
have DW_TAG_namespace, but I do think it will be important for the
next two or three years.
>> are fun bits like how gnuv3_rtti_type looks at the demangled name of
>> the vtable. If it were possible to get rid of that, I would be a
>> happy person indeed, since its existence is probably going to force me
>> to change the demangler's output somewhat. (On the other hand, that
>> call is also a useful canary in the coal mine, too, because of the
>> RTTI warning that comes out of it.)
> I am fairly sure we can kill that for DWARF-2 at least.
Sounds good to me.
David Carlton
carlton@math.stanford.edu
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [rfa] always use demangled name to set scope
2003-06-13 4:28 ` David Carlton
@ 2003-06-13 4:38 ` Daniel Jacobowitz
2003-06-13 18:53 ` David Carlton
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2003-06-13 4:38 UTC (permalink / raw)
To: David Carlton; +Cc: gdb-patches
On Thu, Jun 12, 2003 at 09:28:13PM -0700, David Carlton wrote:
> On Fri, 13 Jun 2003 00:22:14 -0400, Daniel Jacobowitz <drow@mvista.com> said:
> > On Thu, Jun 12, 2003 at 06:01:28PM -0700, David Carlton wrote:
> >> On Thu, 12 Jun 2003 19:17:27 -0400, Daniel Jacobowitz <drow@mvista.com> said:
>
> >> > By 6.1 I want to rip out all uses of the demangled name along the
> >> > DWARF-2 code path though. If I can find the time...
> >>
> >> We'll see. I do think that the nested type deduction machinery is
> >> both useful and impossible to do without demangled names. And there
>
> > I completely disagree. We have all the machinery in DWARF-2 to do it
> > without demangled names by using the available hierarchy; it was
> > designed to suffice for this.
>
> Yeah, but we need DW_TAG_namespace to do it, and a version of GCC
> providing that probably won't be released until next calendar year. I
> certainly don't use demangled names to do nested type deduction if we
> have DW_TAG_namespace, but I do think it will be important for the
> next two or three years.
That's namespace deduction. Nested type deduction is a slightly
different story - the principle is the same but we already have all the
information we need.
> >> are fun bits like how gnuv3_rtti_type looks at the demangled name of
> >> the vtable. If it were possible to get rid of that, I would be a
> >> happy person indeed, since its existence is probably going to force me
> >> to change the demangler's output somewhat. (On the other hand, that
> >> call is also a useful canary in the coal mine, too, because of the
> >> RTTI warning that comes out of it.)
>
> > I am fairly sure we can kill that for DWARF-2 at least.
>
> Sounds good to me.
I just hope I'm right :)
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [rfa] always use demangled name to set scope
2003-06-13 4:38 ` Daniel Jacobowitz
@ 2003-06-13 18:53 ` David Carlton
2003-06-13 18:56 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: David Carlton @ 2003-06-13 18:53 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
On Fri, 13 Jun 2003 00:38:34 -0400, Daniel Jacobowitz <drow@mvista.com> said:
> On Thu, Jun 12, 2003 at 09:28:13PM -0700, David Carlton wrote:
>> Yeah, but we need DW_TAG_namespace to do [nested type deduction],
>> and a version of GCC providing that probably won't be released
>> until next calendar year. I certainly don't use demangled names to
>> do nested type deduction if we have DW_TAG_namespace, but I do
>> think it will be important for the next two or three years.
> That's namespace deduction. Nested type deduction is a slightly
> different story - the principle is the same but we already have all
> the information we need.
Not if the type is nested inside a namespace. If your code is full of
namespace N {
class C {
...
};
}
then, as far as I can tell, you can't tell that C is really N::C
without either DW_TAG_namespace or demangled names. And if you think
it's C, then users get confused if they refer to it as N::C and
nothing happens, and you get constant RTTI warnings when printing out
stuff. (Which, besides being annoying, make ddd impossible to use,
which matters to some people.)
Namespace deduction is less important, I agree.
David Carlton
carlton@math.stanford.edu
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [rfa] always use demangled name to set scope
2003-06-13 18:53 ` David Carlton
@ 2003-06-13 18:56 ` Daniel Jacobowitz
2003-06-13 19:01 ` David Carlton
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2003-06-13 18:56 UTC (permalink / raw)
To: David Carlton; +Cc: gdb-patches
On Fri, Jun 13, 2003 at 11:53:42AM -0700, David Carlton wrote:
> On Fri, 13 Jun 2003 00:38:34 -0400, Daniel Jacobowitz <drow@mvista.com> said:
> > On Thu, Jun 12, 2003 at 09:28:13PM -0700, David Carlton wrote:
>
> >> Yeah, but we need DW_TAG_namespace to do [nested type deduction],
> >> and a version of GCC providing that probably won't be released
> >> until next calendar year. I certainly don't use demangled names to
> >> do nested type deduction if we have DW_TAG_namespace, but I do
> >> think it will be important for the next two or three years.
>
> > That's namespace deduction. Nested type deduction is a slightly
> > different story - the principle is the same but we already have all
> > the information we need.
>
> Not if the type is nested inside a namespace. If your code is full of
Violent agreement again. I'm using the words differently from you; I
was strictly speaking about
class C {
class D {
..
};
};
> namespace N {
> class C {
> ...
> };
> }
>
> then, as far as I can tell, you can't tell that C is really N::C
> without either DW_TAG_namespace or demangled names. And if you think
> it's C, then users get confused if they refer to it as N::C and
> nothing happens, and you get constant RTTI warnings when printing out
> stuff. (Which, besides being annoying, make ddd impossible to use,
> which matters to some people.)
Yes, all definitely true.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [rfa] always use demangled name to set scope
2003-06-13 18:56 ` Daniel Jacobowitz
@ 2003-06-13 19:01 ` David Carlton
0 siblings, 0 replies; 9+ messages in thread
From: David Carlton @ 2003-06-13 19:01 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
On Fri, 13 Jun 2003 14:56:12 -0400, Daniel Jacobowitz <drow@mvista.com> said:
>> > That's namespace deduction. Nested type deduction is a slightly
>> > different story - the principle is the same but we already have all
>> > the information we need.
>>
>> Not if the type is nested inside a namespace. If your code is full of
> Violent agreement again. I'm using the words differently from you; I
> was strictly speaking about
> class C {
> class D {
> ..
> };
> };
Ah, right. I sometimes forget that not everybody in the world thinks
of namespaces as types.
David Carlton
carlton@math.stanford.edu
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2003-06-13 19:01 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-12 22:26 [rfa] always use demangled name to set scope David Carlton
2003-06-12 23:18 ` Daniel Jacobowitz
2003-06-13 1:01 ` David Carlton
2003-06-13 4:22 ` Daniel Jacobowitz
2003-06-13 4:28 ` David Carlton
2003-06-13 4:38 ` Daniel Jacobowitz
2003-06-13 18:53 ` David Carlton
2003-06-13 18:56 ` Daniel Jacobowitz
2003-06-13 19:01 ` David Carlton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox