From: Daniel Jacobowitz <drow@mvista.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [rfa] lookup_transparent_type hack
Date: Mon, 19 Jan 2004 04:25:00 -0000 [thread overview]
Message-ID: <20040119042535.GA10479@nevyn.them.org> (raw)
In-Reply-To: <m3vfnbbg4z.fsf@coconut.kealia.com>
On Fri, Jan 16, 2004 at 03:58:04PM -0800, David Carlton wrote:
> This is a hack for lookup_transparent_type, as a partial workaround
> for PR gdb/1511. The problem there is, if the compiler doesn't
> generate DW_TAG_namespace, then, if we have a class C defined inside a
> namespace N, then when GDB sees an abstract declaration for N::C, it
> will think it's called "C" instead of "N::C". Then
> lookup_transparent_type will get passed "C", and it won't find the
> full definition for the class (which is called "N::C").
>
> I don't see what we can do about this without full debugging info -
> GDB can't very well look in all the namespaces out there. One
Well, we can. I'm thinking about sorting the symbol tables by
basename, as I mentioned earlier. That would make this search easy.
But the only cases where it would be really interesting, it would still
be ambiguous...
> heuristic which has proved useful, however, is to try looking in the
> namespaces associated to the function we're currently within (if any),
> on the theory that we're a bit more likely to be dealing with types in
> those namespaces than types in other namespaces. It's a hack, but it
> does seem to help.
>
> Here's a patch to do that. It needs C++ approval, and it would be
> nice if a symtab person would confirm that it's okay to make
> lookup_transparent_type language-dependent. Tested on
> i686-pc-linux-gnu, DWARF-2, GCC 3.2 both with and without
> DW_AT_namespace; no regressions, and the new test passes in both
> cases. (It shouldn't affect stabs, though I'm running the testsuite
> now just to double-check.)
>
> Okay to commit?
This is OK. I'd also like to see results with 2.95, though I expect no
difficulties. It's a terrible hack, but you're right that it probably
works often enough to bother.
It doesn't work for the case that has been reported twice now:
namespace bar {
class Foo { };
namespace baz {
class Foo : public bar::Foo { };
}
}
There's nothing clear we can do, although bonus points would definitely
be had for making sure we don't resolve the derived type's reference
to the base type to the derived type itself. Again, a hack, won't
catch larger cycles, but would eliminate some infinite loops.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2004-01-19 4:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-16 23:58 David Carlton
2004-01-18 23:48 ` Elena Zannoni
2004-01-19 4:25 ` Daniel Jacobowitz [this message]
2004-01-22 22:00 ` David Carlton
2004-01-22 22:30 ` Daniel Jacobowitz
2004-01-23 23:06 ` David Carlton
2004-01-23 23:08 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040119042535.GA10479@nevyn.them.org \
--to=drow@mvista.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox