Re: [patch/rfc] Recognize non-DW_AT_location symbols

Joel Brobecker
2009-03-20T15:02:58Z

Hi Jan,

> * zero-length DW_AT_location should be the same as missing DW_AT_location.
> https://fedorahosted.org/pipermail/elfutils-devel/2009-March/000180.html

I agree.

I have been trying to understand what is going on in this patch, so
can you bear with me?

The first observation is that dwarf2read treats zero-length DW_AT_location
lists as LOC_OPTIMIZED_OUT. See var_decode_location:

/* A DW_AT_location attribute with no contents indicates that a
variable has been optimized away. */
if (attr_form_is_block (attr) && DW_BLOCK (attr)->size == 0)
{
SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
return;
}

I'll see if I can reproduce using the testcase you provided (I don't
have gcc-4.4 handy, so I can't use the C example you gave).

--
Joel