[Dwarf-Discuss] variable locations - safe use as lvalues

Frank Ch. Eigler fche@redhat.com
Mon Jan 20 22:20:54 GMT 2020


Hi -

I have a question about variable location lists, but not their
encoding, the use they are suitable for.  The basic debugging scenario
is just reading variable values, for which this is fine, especially
when high-quality compilers emit exquisitely detailed data for their
optimized code.

But what about writes - as though one could edit the program to insert
an assignment, and resume?  A whole slew of complications come up:

- trying to modify a variable permanently, but the compiler only
  emitted -some- of its locations

- trying to modify a variable (and only one), but the compiler put two
  variables into the same location at that PC

- expressions using that value as input might have already started
  to be computed, so it may be too late to change it at the PC
  in question

- ... and undoubtedly other complications exist!

A debugger cannot currently be told that any particular variable
location expression is safe to use as an lvalue, something roughly
"exclusive, exhaustive, -O0-equivalent".  I believe most debuggers
don't even handle the multiple-locations case for writes at all.  I
don't know why - assume complications are rare?  or we have kind of
papered over the problem?

As a DWARF standard level matter, descriptive rather than prescriptive
as it is, what might be the minimum extension required to communicate
lvalue-safety to a debugger?  A DW_OP_lvalue_safe assertive wrapper
around a real expression?


- FChE




More information about the Dwarf-discuss mailing list