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] Add dwarf2.1 namespace support


Jason Merrill <jason_merrill@redhat.com> writes:

>>>>>> "Daniel" == Daniel Berlin <dan@cgsoftware.com> writes:
> 
>> Note that the toplev.c change is because if we don't do that, we get
>> namespace decls as the absolute last thing output.
> 
> I don't see any reason to handle namespaces differently from classes in
> this respect.  I'd prefer to just avoid emitting multiple DIEs for a
> namespace.

Okay.

> 
> Also, we still need to handle namespace aliases, and this seems like the
> right place.

Sure.

Here's a related question, however:
What do I do about using_decl's.
They don't exist by the time we go to output debug info.
We only see the results.
This will cause us to output mountains of debug info that can't be
easily dupe-eliminated, since we have no idea those symbols really
came from somewhere else, and are absolutely duplicates.  We'd have to
being able to change real DIE's into imported declarations.

> 
>> Doing it that way, instead of generating them when we see something
>> use them,  would require fixing up the scope of literally
>> everything in a namespace, which would seem to be a very not fun thing
>> to implement.
> 
> Agreed, we want to generate the namespace DIE as soon as we try to emit
> something inside it.
> 
>> !   /* Handle namespaces properly */
>>     if (containing_scope && TREE_CODE (containing_scope) == NAMESPACE_DECL)
>> !     context_die = lookup_decl_die (containing_scope);
> 
> Perhaps assert that this produces a non-null value?
Sure.

>   
>> *************** dwarf2out_decl (decl)
>> *** 10967,10972 ****
>> --- 10983,11000 ----
>>     if (TREE_CODE (decl) == ERROR_MARK)
>>       return;
>     
>> +   if (DECL_CONTEXT (decl) && TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL)
>> +     {
>> +       context_die = lookup_decl_die (DECL_CONTEXT (decl));
>> +       if (context_die == NULL)
>> + 	{
>> + 	  dwarf2out_decl (DECL_CONTEXT (decl));
>> + 	  context_die = lookup_decl_die (DECL_CONTEXT (decl));
>> + 	  if (!context_die) 
>> + 	    abort();
>> + 	}
>> +     }
>> + 
>>     /* If this ..._DECL node is marked to be ignored, then ignore it.  */
>>     if (DECL_IGNORED_P (decl))
>>       return;
> 
> This code should go in gen_decl_die, like the existing code to force out a
> containing class.
Okay.

> 
> 
>> *************** dwarf2out_decl (decl)
>> !     case NAMESPACE_DECL:
>> !       if (debug_info_level <= DINFO_LEVEL_TERSE)
>> ! 	  return;
>> !       break;
> 
> Won't this cause the compiler to abort in the code above?
Yes. I realized this at the time.
I'll fix it.
However, we abort anyway at -g1, due to other problems. And -g1 is
pretty worthless, it provides nothing minimal symbols in gdb don't
have already anyway.
We should probably just remove it.

> 
> Jason

-- 
"Winny and I lived in a house that ran on static electricity...
If you wanted to run the blender, you had to rub balloons on
your head.  If you wanted to cook, you had to pull off a sweater
real quick.
"-Steven Wright


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