[Dwarf-Discuss] About self-referencial sized types
Pierre-Marie de Rodat
derodat@adacore.com
Tue Jun 10 09:29:33 GMT 2014
On 05/16/2014 03:00 PM, Agovic, Sanimir wrote:
> Indeed, therefore you have to reference a DW_TAG_variable. But
> this introduces a type/variable dependency. So a record type maps
> to a single variable, you end up with a 1:1 relation for this kind of
> types.
The size of the debug information is already an issue, so I guess such
1:1 relations would make things worse. ;-)
> Unfortunately gdb only allows constant offsets or constant dwarf expressions.
>> [...]
>> ... It would work pretty well, actually! I'm not sure if this would
>> really be the way to go:
>>
> It is indeed quite hackish and we should rather add the necessary bits
> to gdb.
Agreed.
> The problem is that the member offset depend on runtime information similar
> to sizeof which needs to be evaluated at runtime if the operand is a vla.
>
> Given the following snippet:
>
> struct foo {int a[n], int b[i];};
>
> &((struct foo *)0)->b;
>
> What value do you expect here? And should the value be different if it is
> evaluated at runtime e.g. &f.b - &f.a?
I cannot tell for C, but the corresponding expression is supposed to
raise a Constraint_Error exception in Ada (this is how all null pointer
deferences are supposed to behave).
--
Pierre-Marie de Rodat
More information about the Dwarf-discuss
mailing list