[fpc-devel] stabs replaces ^byte to PByte, but only if PByte exists

Martin fpc at mfriebe.de
Thu Dec 16 18:13:14 CET 2010


On 16/12/2010 09:37, Jonas Maebe wrote:
>
> On 16 Dec 2010, at 02:12, Martin wrote:
>
>> 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.

could it be the linker?

in GCC it seems the linker can do that... (as there is an option to 
suppress it). so maybe the fpc (internal) linker does something similar?



More information about the fpc-devel mailing list