[Dwarf-Discuss] question about [0x0..0xffffffff] location list entry

Joel Brobecker brobecker at adacore.com
Wed Jan 19 12:35:10 PST 2011


Hello,

I was wondering if I could have your opinion on the following DWARF
data...

A user wrote some C code with a global variable defined in a unit.
This global variable is not static.  The DWARF debug info for it
looks like:

 <1><143010>: Abbrev Number: 135 (DW_TAG_variable)
    <143012>   DW_AT_decl_line   : 166
    <143014>   DW_AT_decl_file   : 26
    <143016>   DW_AT_type        : <0xe6e1>
    <14301a>   DW_AT_external    : 1
    <14301b>   DW_AT_location    : 0x90068      (location list)
    <14301f>   DW_AT_name        : blablabla

The location list entry, as dumped by readelf looks is:

    Offset   Begin    End      Expression
    00090068 0009f7c4 0009f7c3 (DW_OP_addr: 4000d120)
    00090068 <End of list>

A raw dump of the .debug_loc section at the offset where our
location list is located shows that begin and end offsets are
0x0 and 0xffffffff (address size is 32bits).

I believe that the intention behind this location list entry is
to say: variable lives at DW_OP_addr=4000d120 for all PC addresses
(infinite range).

But I also believe that this is not saying what they thing it is
expressing.  According to the way I understand the DWARF4 standard,
I believe that the above should mean that the variable is live
only for PC addresses starting at 0x0009f7c4 (the base address
of the unit containing that variable).  So the live range for
that address, as expressed, is [0x0009f7c4..+Inf[.

What do others think?

Thanks!
-- 
Joel



More information about the Dwarf-Discuss mailing list