Sign in Join

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

Mailing lists / fpc-devel / 2010-12

debug info for ^TObject vs just TObject

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Martin
type
   TFoo = class
   public
     FooValue: Integer;
   end;
   PFoo = ^TFoo;
procedure FooFunc(  Foo1: TFoo;   pFoo1: PFoo);

ptype Foo1
"~"type = ^TFOO = class : public TOBJECT \n""
ptype pFoo1
"~"type = ^TFOO = class : public TOBJECT \n""

Is gdb hiding something, or does FPC encode both types with the same info?

Since an object is encoded in it's internal pointer form, shouldn't the pointer to an object be ^^TFoo?

Martin

Reply by email

Martin
to Martin
Martin wrote
type TFoo = class

...

Show quoted text 10 lines
PFoo = ^TFoo; ptype Foo1 "~"type = ^TFOO = class : public TOBJECT \n"" ptype pFoo1 "~"type = ^TFOO = class : public TOBJECT \n"" Is gdb hiding something, or does FPC encode both types with the same info?

Equally it seems that (dwarf)

var Ansistring
var Char
var PChar

are all encoded as
ptype Foo1
"~"type = &Char\n""

I guess pchar, and ansistring (if passed as var param) should be &^Char ?

Martin

Reply by email

Jonas Maebe
to Martin: type TFoo = class public FooValue: Integer; end; PFoo = ^TFoo; procedure FooFunc( Foo1:…
Martin wrote 16 lines
type TFoo = class public FooValue: Integer; end; PFoo = ^TFoo; procedure FooFunc( Foo1: TFoo; pFoo1: PFoo); ptype Foo1 "~"type = ^TFOO = class : public TOBJECT \n"" ptype pFoo1 "~"type = ^TFOO = class : public TOBJECT \n"" Is gdb hiding something, or does FPC encode both types with the same info?

I think it's a bug in gdb's Pascal type printer, because if you set the language to C then it does print the correct number of pointer indirections:

(gdb) ptype FOO1
type = class TFOO : public TOBJECT {
public:

    LONGINT FOOVALUE;

} *
(gdb) ptype PFOO1
type = class TFOO : public TOBJECT {
public:

    LONGINT FOOVALUE;

} **

(see the '*' and '**')

Jonas

Reply by email

Martin
to Jonas Maebe
Jonas Maebe wrote 14 lines
(gdb) ptype FOO1 type = class TFOO : public TOBJECT { public: LONGINT FOOVALUE; } * (gdb) ptype PFOO1 type = class TFOO : public TOBJECT { public: LONGINT FOOVALUE; } ** (see the '*' and '**')

Thanks,

yeah i looked at the internals (gdb "maint print type") and they are indeed different.
It's gdb, gdb only show one "^" OR "&" at a time => never mind how many lvls of pointer there are.

gdb is real fun..... ;)

Martin

Reply by email

Jonas Maebe
to Martin
Martin wrote
yeah i looked at the internals (gdb "maint print type") and they are indeed different. It's gdb, gdb only show one "^" OR "&" at a time => never mind how many lvls of pointer there are. gdb is real fun..... ;)

One reason might be that almost nobody in the Pascal community files bug reports against it.

Jonas

Reply by email

Martin
to Jonas Maebe
Jonas Maebe wrote 7 lines
On 16 Dec 2010, at 00:06, Martin wrote: > yeah i looked at the internals (gdb "maint print type") and they are indeed different. > It's gdb, gdb only show one "^" OR "&" at a time => never mind how many lvls of pointer there are. > > gdb is real fun..... ;) One reason might be that almost nobody in the Pascal community files bug reports against it.

It also applies to "normal" pointer to pointer to pointer ... PByte
PPByte
...

and similar stuff does exist in c => though I haven't tested what it does there...

But I have the feeling it is intention.

If I go

WhatIs Symbol
WhatIs ReturnedType
...

I can get each and every level.
ptype on the other hand, just seems to tell me, the final type, and if there is any pointer anywhere involved...

Martin

Reply by email