Designs for better debug info in GCC

Alexandre Oliva
Wed Dec 19 19:46:00 GMT 2007

On Dec 19, 2007, "Daniel Berlin" <> wrote:

> On 12/18/07, Alexandre Oliva <> wrote:

>> Dwarf enables arbitrary value expressions too.
> Well, uh, no.

> The only way to directly specify the value of a variable is for
> constants. DW_AT_const_value does not allow location descriptions.

DW_AT_const_value is irrelevant for location lists.  It's DW_OP_* that
I'm talking about.

That said...  I can't find any more the equivalent of
DW_CFA_val_expression in DW_OP_*s that could be used in location
expressions.  I just *knew* it was there, but I guess I just imagined
it.  This is embarrassing.

At this point, there are three options available:

- go back to the drawing board

- discard altogether expressions that don't represent lvalues (maybe
  don't even keep track of them)

- introduce a DWARF extension that enables value expressions to be
  used in location lists (say DW_OP_value, DW_OP_temp_location, or
  even DW_OP_self_location (*))

(*) maps value to a virtual location that, if dereferenced, evaluates
to the value.  Could be "easily" implemented through a virtual
out-of-range base address, plus the offset that represents the value
on dereference, but there are many other ways to implement this in
debug information consumers.

> I'm still curious where you think it describes value expressions for
> variables other than constants

Me too :-)  :-(

Thanks for drawing my attention to this incorrect assumption I made
about DWARF location lists.

> i'd support such an extension

Cool.  Do you happen to know the procedure to propose DWARF standard

Alexandre Oliva
FSF Latin America Board Member
Red Hat Compiler Engineer   aoliva@{,}
Free Software Evangelist  oliva@{,}

More information about the Gcc-patches mailing list