[fpc-devel] dwarf 3 implementation issue

Martin Frb lazarus at mfriebe.de
Fri May 9 21:08:18 CEST 2014


On 08/05/2014 21:11, Martin Frb wrote:
>
> So the entire point is, the debugger should know that they are pointers.
>
> Hidding this from the debugger gets wrong results.

Besides that GDB fails on those anyway (at least the gdb I have). Here 
is another one, that does not (and can not) work with the current 
expression location in gw3

program dyarr;
type
  TX=array of integer;
var
   a: TX;
   p: PtrUint;
begin
   SetLength(a,3);
   a[0] :=  1; a[1] :=  2; a[2] :=  3;
   p := ptruint(a)-4;
   writeln( TX(p+4)[1] ); //writes 2
end.

-data-evaluate-expression TX(p+4)

DW_AT_data_location starts with DW_OP_push_object_address

It needs the address of the variable. But "p+4" has no address.

A debugger could still use it as a pointer, so the dwarf 2 definition 
could work (as I said, I got trash in gdb with either dwarf / but the 
problems of gdb are not the point)

The new dwarf3 does simple not describe the type dyn-array

yet, if the type was pointer to array, then the important location 
expression for the array upper bound could still be added to the 
subrange definition. It would use a DW_OP_push_object_address too, but 
that would then refer to the array after the pointer was already 
resolved (at least it should)





More information about the fpc-devel mailing list