This is the mail archive of the dwarf2@corp.sgi.com mailing list for the dwarf2 project.


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

Re: location lists



davea@sgi.com wrote:
> But section 4.1 (draft 5 page 53) says non-defining declarations
> are not allowed to have a location attribute (bullet 3.).
> (the words are just a tiny bit soft, but that's how I read it).

Michael Eager wrote
|Let's say you have the following code in A.c:
|
|        extern int i;
|
|        foo ()
|        {
|                for (i=0; i < 100; i++) {
|                ...
|                }
|        }
|
|If the compiler moves i into a register, I would hope that
|there would be some way to describe its lifetime.  Is 
|"extern int i" a defining declaration?  Only the linker 
|knows for sure.

I would hope so too.

|Section 4.1 does prohibit location expressions for 
|non-defining declarations.  But see section 2.12 which 
|mentions that a debugger might need a DIE for a non-defining 
|declaration to be able to evaluate an expression.  Seems
|like this might be one case where this might apply.

But 2.12 does not give the compiler permission
to put a location on the DIE! 
I cannot quite see how 2.12 has any effect unless
the DIE contains a location or ???.

|If there is a defining declaration for "int i = 0;"  in B.c,
|then a location expression with the declaration couldn't
|describe that it was in a register in a A.c.

Well, yes, that is a problem!

|I'm not sure exactly why section 4.1 contains the prohibition.
|I think it had something to do with prototypes.

I don't recall why. 

I think we're agreed the prohibition is silly and
should be removed, right?.

Regards,
David B. Anderson davea@sgi.com danderson@acm.org http://reality.sgi.com/davea/


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