Martin wrote 24 lines
On 15/12/2010 23:44, Martin wrote:
> An other interesting part of debug info (2.4.2 and trunk)
>
> If I define a variable
> var
> Foo: ^TFoo;
>
> then if no type "xxx=^TFoo" exists, both stabs and dwarf will write
> debug info that contains "^TFoo"
> (tested with ptype, and "maint print type")
>
> But if a Type PFoo=^TFoo exists, then stabs will replace the debug
> info and use PFoo.
> dwarf still does ^TFoo
>
It seems fpc trunk goes even further. with trunk and stabs, the
following is also combined
TMyShortstring = ShortString;
PMyShortstring = ^TMyShortstring;
now instead of PMyShortstring gdb says PShortstring
2.4.2 (and the same gdb) still made them differ.
This is how the debug information for pointer types is written for stabs:
ss:='*'+def_stab_number(tpointerdef(def).pointeddef);
This is how it's written for DWARF:
append_entry(DW_TAG_pointer_type,false,[]);
if not(is_voidpointer(def)) then
append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.pointeddef));
I.e., in both cases FPC outputs "pointer type" (resp. '*' and 'DW_TAG_pointer_type') followed by a reference to the type the pointer points to. This is the same in FPC 2.4.2 and in trunk. The merging probably happens inside gdb's Stabs reader, and may depend on the order in which the declarations appear in the debug information.
Jonas