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

Michael Eager eager@eagercon.com
Wed Jan 22 00:09:35 GMT 2020


On 1/21/20 3:17 PM, Greg Clayton via Dwarf-Discuss wrote:
> 
> 
>> On Jan 21, 2020, at 2:58 PM, Frank Ch. Eigler via Dwarf-Discuss <dwarf-discuss at lists.dwarfstd.org> wrote:
>>
>> Hi -
>>
>>> While dwarfdump has 'check the DWARF' options available the
>>> location list overlap test is not done at all. The -kl option suggests
>>> it does loclist checking, but its checking is rather superficial.
>>
>> Note that one should not present these overlaps as -errors- (because
>> they may be accurate), but rather as complications for lvalue usage.
>>
> 
> Indeed. Warnings might be nice if the locations expressions are the same _and_ the types are different.
> 
> It would be very hard to figure out in a language agnostic way if two types are not the same ("int" and a typedef to a "int" for example for C based languages).

A checker can walk down the type tree to find if the two types have the
same base types.

Common subexpression elimination could reuse the computed value even if
the source types were different.  (In C, typedef is an alias for a type,
not a different type.  C++ is marginally more restrictive.)

A debugger could alert the user that another variable also occupies the
same location and has been modified.  That might reduce the surprise
factor.  But this depends on neither of the complication 3 cases being
true, and there may be no way to confirm this.  This might give the user
an even stronger false impression that the new value is being used, when
it isn't.

-- 
Michael Eager    eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306



More information about the Dwarf-discuss mailing list