[Lazarus] debug hints in lazarus [Re: [fpc-devel] Status and ideas about debug info (stabs, dwarf / dwar3)]

Martin lazarus at mfriebe.de
Tue Sep 13 20:50:20 CEST 2011


On 13/09/2011 19:17, Graeme Geldenhuys wrote:
> On 13 September 2011 16:26, Martin wrote:
>> ShortDateFormat is declared in the RTL
>> So you need an rtl with debug info.
> I realized that as soon as I read Vincents reply. :-) But then, why
> does it work in Delphi?
Becuase the delphi compiler (not debugger)  does add infor for the those 
global vars (but skips any debug info for funtionx)...

>> So is much of the code I use. If properties do not modify the state of that
>> app, or objects (and that is kind of vital to allow running getter
> I guess my other problem is that I often have an application singleton
> function that returns the application instance.
If it is a plain function (not a method), and if it takes no param => 
try (without the quotes)
"gMyApplication()"
"gMyApplication().CurrentUser"

I can't gurantee it will work. but if you get real lucky...

> eg:  I need to change my debug expression from:
>
>        gMyApplication.CurrentUser.Name

>> can under no circumstances be debugged using gdb =>  I must say, I have a
>> huge amount of respect for your archivment of implementing fpgui without
>> using any debugging at all. WOW.  (scnr :)  )
> I use tiOPF's tiLog unit for 95% of my debugging needs. I
...
> so debugging works quite
> well, contrary to what you might think.
You did read the "scnr" followed by a common emoticon?

>   AND the output is always
> readable, unlike the current state of Lazarus trunk.  ;-)
And you do output entire classes, or just individual fields?

Because I use the watch window. I display:
- fields
- properties that map to fields
- parameters , local and global vars of simple type, or their fields
And the output looks quite good as well

Further more I have like you a history of output => only if I select any 
of the previous values of my watches, I also get the callstack, that was 
at the time, and I can click the callstack.
I can even save the entire recorded debug session to a file. And import 
it. (and soon / fixing right now) import will also work on some-one 
elses installation, allowing to send the content to coworkers (providing 
the comfort of a click-able callstack for each entry in history)


>> I just say from my personal experience,  I can live without it, but that may
>> just be me.
> And I'm just saying that debugging is Delphi is so much less effort
> than with FPC. In Delphi I can get on with my work, in Lazarus I have
> to fight a debugger.
That is what I meant by "missing comfort", quite different from totally 
unusable (though I can see the issue with global vars from rtl doesn't help)

> But please don't take this the wrong way, I am
> really glad to see all your hard work and efforts in trying to improve
> debugging under Lazarus. It is definitely improving.
No worries, I am not taking it personal.

And i am not defending it just because I happen to be involved.

But of course as it turned out, some of the differences in the judgment 
were because we had different results, but didn't know that was the case.

I never knew some people did not see variables from rtl. It never 
occurred to me, as it always worked for me...
Now take that into account: Of course I couldn't understand "95% of 
identifiers just say 'unknown'".

>>> I also agree, that being able to read the field variable value via 
>>> the property name would already be a huge improvement. NOTE: I 
>>> mentioned here "via property name", not field name, because often I 
>>> don't know what the field name is, especially if you have a large 
>>> hierarchy of objects. 
>>
>> maybe again that you have units without debug info (or you mix dwarf and
>> stabs)?
> I use only DWARF debug info. I believe this is the standard under
> 64-bit FPC anyway.

Hm that is stranhe. i tested here. Fields (as long as they map to 
properties work. they work even if they are in a unit without debug info 
(TComponent) => as long as you have a class that inherited from it, and 
that class is in a unit with dwarf.

Though I only tested under 32 bit (and win).

I am not sure what the minimum fpc version for this is.




More information about the Lazarus mailing list