[Lazarus] Class operators

Martin lazarus at mfriebe.de
Tue May 24 13:34:18 CEST 2011


On 24/05/2011 08:14, Mattias Gaertner wrote:
> On Tue, 24 May 2011 00:35:19 +0100
> Martin<lazarus at mfriebe.de>  wrote:
>
>> [...]
>> (^^PChar(Sender)^+3)^+1
>>
>> It should give you the real classname
> Can this be used in the debugger hint, when moving the mouse over 'Sender'?

It should work on all modern gdb, 32 and 64 bit. PChar is not guaranteed 
to be defined, but can be replaced by ^char

One problem is that the string is not 0 terminated, so you get trash at 
the ned => it is a shortstring. If shortstring is defined  (the debugger 
knows internally) then Shortstring can be used.
Otherwhise the length should be (not tested):  (^^^Byte(Sender)^+3)^^
Basically class name is the 3rd entry in the PVMT

It should probably be added to the debugger => e.g to GDBTypeInfo
But I see no problem with putting it in the IDE code until then.

But I only want to evaluate it , if really requested => watches eval 
already takes long enough.

There is a flag that can be passed to GDBEvaluate, it could be used to 
trigger the info => ultimately type-info should keep a reference to GDB, 
so it can fetch info, on access (but then it neds a callback, since info 
may not be immediately avail...




More information about the Lazarus mailing list