[Lazarus] Status of GDB and Lazarus/FPC debugging threaded apps

Martin lazarus at mfriebe.de
Mon Jan 10 16:03:57 CET 2011


On 10/01/2011 14:41, Andrew Brunner wrote:
> Debugging under Linux (Ubuntu) is the largest development pain, and
> has persisted since I started cross platform development with
> FPC/Lazarus.  I was wondering what if anything could be done to get a
> bug report together and submit something to either GDB or X.org, or
> identify the source of the problem and resolve it so we can debug
> without having to restart the desktop manager.
>
> Recently, main threaded debugging doesn't crash the gdm but threading
> still does.  If I set a break point for a threaded method, I can step
> two or three lines down/deep before the desktop manager hangs and I
> have to open a terminal session with ctrl+alt+F2 and sudo service gdm
> restart.
In your case you should refine your statement:
    "Debugging under Linux (Ubuntu) is the largest development pain"
versus:
    "threaded debugging"

While debugging threaded apps should be no special at all, it probably 
still is....
And so is 64 bits at current => simply due to the lack of testing it had


Also make sure your debugged app, does not have any console output itself...
http://bugs.freepascal.org/view.php?id=12172

> What would be involved in running the GDM under debugger and seeing
> where in the world it crashed?  Is this too big of a task?

I don't know what makes the x server hang, so I can't help you much on 
that...
Also if gdb itself crashes....

But to get you some info; as for the lazarus side:
Compile the IDE with
   -dDBG_VERBOSE -dDBGMI_QUEUE_DEBUG

and start it from a console, so you can see the IDE's debug output.

That way you will get all the communication between the IDE and gdb; including some warnings, and state info. (You will see if the IDE thinks the app is pause or running =>  if that differs from the real state, then obviously there is an issue)


> I noticed GDB has done some updating w/r/t FPC in the past and was
> wondering whose responsibility this might fall on.  It seems to me
> like this problem is way beyond the scope of Lazarus or FPC but I hope
> with some noise we possibly could get some stability while debugging
> threaded apps.
>

If you get it to work in gdb by hand, and find out what Lazarus needs to 
to different....

-------------
You can also compile the IDE with
    -dDBG_WITH_DEBUGGER_DEBUG
this will add an edit field and button to the "debug output" window. So 
you can test gdb commands from the IDE.
   BUT this is low level, and not guarded => this allows you to screw up 
the debug session, and it is supposed to allow you to do this...
   This is to develop on the debugger integration, not to debug an app.
= > You must not / never issue a command that will change between 
run/pause state => as the IDE will not update it's internal state => and 
once you got them out of sync, you can only start killing stuff the 
hardcore way.





More information about the Lazarus mailing list