------- Additional Comments From dberlin at gcc dot gnu dot org  2005-03-16 
04:25 -------
Subject: Re:  [4.0/4.1 Regression] GCC produces wrong dwarf2
        output that breaks gdb

On Wed, 2005-03-16 at 03:54 +0000, wilson at gcc dot gnu dot org wrote:
> ------- Additional Comments From wilson at gcc dot gnu dot org  2005-03-16 
> 03:54 -------
> Part of the problem here is the way that declare_in_namespace works. 
> gen_variable_die, calls declare_in_namespace, which checks to see if the
> variable has a namespace, and if so emits it into that namespace. 
> declare_in_namespace then returns, and gen_variable_die finishes normally, 
> which
> means we end up with DIEs for one variable.  The local one in the current
> context, and the one emitted into the namespace.  The variable in question 
> here
> has a namespace of "::".
> 
> When we process the abstract instance of f, we emit a local die for i into f,
> and a namespace one into :: the global context.  This one has line 3.  Then we
> see the global redeclaration, and emit another die into the global context. 
> This one has line 6.  Then when we handle the function main, we see the 
> inlined
> version of f, and we get a decl of i with an abstract origin pointing at the
> function f, and emit two more dies, one local one in the inlined version of f
> that points at the abstract instance of f, and one global one that also points
> at the abstract instance of f.  This last one is very wrong.  Note that there
> are 5 dies not 4 as I claimed earlier, I missed the one in 'main' when I was
> counting them.
> 
> It seems very silly to try to emit a namespace version of a decl with an
> abstract origin.  One possible solution is for declare_in_namespace to ignore
> any decl with an abstract origin.  If I try this, I get only 4 dies, and gdb 
> is
> happy.  We still have two global dies, with different line numbers, but we can
> live with that for now.
> 
I'm pretty sure declare_in_namespace was something either jason wrote
with my help, or i wrote with jason's help (i can't remember), and i'm
pretty sure this problem didn't occur to either of us.

I agree that  outputting a namespace version of an inline die with an
abstract origin is indeed silly, since i don't believe it could possibly
be the one that actually belongs in that namespace (which would be
whatever the actual abstract origin points to).


> I haven't yet tried to trace the history of this, to determine what change
> caused the problem to appear.  There might be something else wrong here.
> 



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19769

Reply via email to