Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-12

stabs replaces ^byte to PByte, but only if PByte exists

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin

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 is of course possible that the debugger goes a long way in finding the matching info, but even the raw output of gdbs internals have the substitute....

Martin

Reply by email

Martin
to Martin
Martin wrote 14 lines
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.

Martin

Reply by email

Jonas Maebe
to Martin
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

Reply by email

Martin
to Jonas Maebe
Jonas Maebe wrote 19 lines
On 16 Dec 2010, at 02:12, Martin wrote: > 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. 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.

ok, thanks for the info.

interesting trunk then must write stabs in a dif order.

As I used the same source, same compiler-switches (except gs versu gw) amd same version of gdb on the same computer. only changed the compiler.

Martin

Reply by email

Martin
to Jonas Maebe: This is how the debug information for pointer types is written for stabs:…
Jonas Maebe wrote 44 lines
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?

Reply by email