This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] DWARF2 namespace support


>>>>> "Daniel" == Daniel Berlin <dan@cgsoftware.com> writes:

> Jason approved this eons ago (I never got around to committing it), with
> the condition that I move the forcing out of namespaces/etc into a
> seperate function, named force_out_decl.

> I just wanted to make sure this is what he had in mind.

Not exactly; I had in mind that the argument to force_out_decl would be the
namespace, not the decl that requires it.

> Note that this is going to break C++ debugging on debuggers without even
> trivial support for the draft dwarf 3.0 (since the things in a namespace
> are children of the namespace die, and debuggers that just ignore DE's
> they don't comprehend don't look at the children of ignored DIE's).

True.

> Since this isn't the only nice thing in dwarf 3.0 that it would be good
> to start implementing or are implemented (The location lists support the
> 3.0 extension to allow a base address specifier, so if a variable is in
> two sections, depending on the pc, we can properly describe the location,
> for instance), it might make sense to add a -gdwarf-3 flag, and only
> output namespaces, etc, when it is given, until more debuggers support
> the dwarf 3 draft features.

> Thoughts?

Makes sense to me.  When gdb supports namespaces, we can switch -ggdb to be
dwarf 3.

> !   /* Handle namespaces properly */
>     if (containing_scope && TREE_CODE (containing_scope) == NAMESPACE_DECL)
> !     {
> !       dw_die_ref newcontext = lookup_decl_die (containing_scope);
> ! 
> !       if (!newcontext)
> ! 	{
> ! 	  gen_decl_die (containing_scope, context_die);
> ! 	  newcontext = lookup_decl_die (containing_scope);
> ! 	  if (!newcontext)
> ! 	    abort();
> ! 	}
> !       context_die = newcontext;
> !     }

For instance, here I would write

  if (containing_scope && TREE_CODE (containing_scope) == NAMESPACE_DECL)
    context_die = force_out_decl (containing_scope, context_die);

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]