This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Fix namespace aliases (c++/7539, c++/10541)
- From: Tom Tromey <tromey at redhat dot com>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: "gdb-patches\ at sourceware dot org ml" <gdb-patches at sourceware dot org>
- Date: Mon, 29 Jul 2013 14:28:42 -0600
- Subject: Re: [RFA] Fix namespace aliases (c++/7539, c++/10541)
- References: <51F2CAB9 dot 2030604 at redhat dot com>
>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
Keith> This is an attempt to fix namespace alias bugs reported in c++/7539
Keith> and c++/10541.
Thanks for working on this.
Keith> @@ -212,6 +213,13 @@ inspect_type (struct demangle_parse_info *info,
Keith> /* Get the real type of the typedef. */
Keith> type = check_typedef (otype);
Keith> + /* If the symbol is a namespace and its name is no different
Keith> + than the name we looked up, this symbol is not a namespace
Keith> + alias and does not need to be substituted. */
Keith> + if (TYPE_CODE (otype) == TYPE_CODE_NAMESPACE
Keith> + && strcmp (TYPE_NAME (type), name) == 0)
Keith> + return 0;
Keith> +
Ok, I think I see what is going on here. For an alias A we have a
symbol named A, whose type is the type of the referent.
I think the comment here is a bit confusing since it says "its name",
but really it means the symbol's type's name.
I'm curious how this copes with some other situations.
For example, an import of a declaration from another namespace, where
the imported declaration is itself an import.
Or, if the program is stopped in a function inside a namespace, can the
user use the "local" (not fully qualified) alias?
I don't think either of these situations is tested.
Keith> @@ -7732,6 +7736,32 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
Keith> read_module (die, cu);
Keith> break;
Keith> case DW_TAG_imported_declaration:
Keith> + {
Keith> + struct attribute *attr;
Keith> +
Keith> + attr = dwarf2_attr (die, DW_AT_import, cu);
Keith> + if (attr != NULL)
Keith> + {
Keith> + /* If the die does not have a name, this is not a namespace
Keith> + alias. */
Keith> + attr = dwarf2_attr (die, DW_AT_name, cu);
Keith> + if (attr != NULL)
Keith> + {
It's customary not to have a body of code in process_die, but to instead
call a helper function.
Tom