[RFA] Fix namespace aliases (c++/7539, c++/10541)

Keith Seitz keiths@redhat.com
Tue Sep 17 23:03:00 GMT 2013


On 07/31/2013 11:46 AM, Tom Tromey wrote:
    ^^^^^^^^^^
Wow, it has taken a bit longer to rotate this back onto my plate than 
I'd hoped. Sorry for the long delay.

>>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
>
> I was also curious why the new type is a TYPE_CODE_NAMESPACE and not a
> TYPE_CODE_TYPEDEF.  Maybe that is too goofy though.

That sounded goofy to me, too. I think neither choice is exactly what we 
(I?) want to describe. I happened to pick TYPE_CODE_NAMESPACE as the 
more appropriate choice.

> Now I'm concerned that bad DWARF can send gdb into an infinite loop
> here.

Ha, yeah. That's a little aggressive on my part.

> Sorry about that.  If compilers don't emit chained imports like this,
> then it is fine to just go back to the old code.

While there's no reason for a compiler to do this, there's also no 
reason one couldn't. So I've decided to play it safe and leave the code, 
fenceposting the maximum number of lookups that the code will do. Right 
now, I've randomly selected 200 imports as the limit.

When this limit is exceeded, it will issue a complaint (and stop 
attempting to read the import). This seems to be the norm in dwarf2read.c.

I've added an additional test case which generates arbitrary depth 
recursive imported declarations and checks for the complaint.

Keith

ChangeLog
2013-09-17  Keith Seitz  <keiths@redhat.com>

	PR c++/7539
	PR c++/10541
	* cp-support.c (insepct_type): Add support for substituting
	namespace aliases, too.
	* dwarf2read.c (scan_partial_symbols): Add a partial symbol
	for DW_TAG_imported_declaration.
	(add_partial_symbol): Likewise.
	(process_die): Handle namespace aliases with
	read_namespace_alias.
	(die_needs_namespace): Add DW_TAG_imported_declaration.
	(read_namespace_alias): New function.
	(load_partial_dies): Load DW_TAG_imported_declaration, too.
	(new_symbol_full): Handle DW_TAG_imported_declaration.

testsuite/ChangeLog
2013-09-17  Keith Seitz  <keiths@redhat.com>

	PR c++/7935
	PR c++/10541
	* gdb.cp/nsalias.exp: New file.
	* gdb.cp/nsalias.cc: New file.
	* gdb.cp/nsrecurs.exp: Remove kfails. Conditionally run
	tests only on known, working compiler versions.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: namespace-aliases-2.patch
Type: text/x-patch
Size: 14868 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20130917/157afa6a/attachment.bin>


More information about the Gdb-patches mailing list