[Lazarus] Multi-Threaded Debugging under Linux (GDB CRASH Work-Around)

Andrew Brunner andrew.t.brunner at gmail.com
Mon Feb 7 15:05:11 CET 2011


On Mon, Feb 7, 2011 at 6:09 AM, Michael Schnell <mschnell at lumino.de> wrote:
> On 02/06/2011 04:08 AM, Andrew Brunner wrote:
>
> This might sometimes be a workaround, but in fact the synchronized method
> runs (much later than being called) in the main thread and not in the
> thread, while the thread is stalled. So this changed the behavior of the
> thread greatly.
>
> -Michael
>

I think what makes this solution for me so valuable is that these are
worker threads that I need to debug.  I use an elaborate system of
methods that don't wait or need to wait for another event.  If they
do, I exit the event and keep that task pending.  This way the manager
thread gets to say which thread executes what method and at the
desired time.

If you use a flagging system on the worker objects to keep track of
what methods are needed or complete, you may remove all intricate
waits, you will find your manager's thread/process merely iterating
ptrs to worker objects (not threads), and examining the operation
flag, and the manager will execute as needed.  If you switched to that
model, it would most likely payoff in debugging because one manager
thread is "managing" all worker objects and all methods are coded to
the manager class.  But *you* know your project and what it was
intended for and how best to design it.

I'm just trying to let people know how to get around a long-standing
albeit crippling issue I had under Linux.




More information about the Lazarus mailing list