[Lazarus] Post-Mortem Debugging

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Thu Feb 26 21:22:04 CET 2015


Martin Frb wrote:
> On 26/02/15 19:52, Mark Morgan Lloyd wrote:
>> I've just forced a core dump of a misbehaving multithreaded program 
>> and am looking at it using gdb to good effect.
>>
>> Can Lazarus be used as a post-mortem debugger, reminiscent of products 
>> from Logitech et al?
>>
> probably not without changes.
> 
> I havent used gdb for this either, so I am not aware which commands you 
> can send to gdb.
> 
> I guess that the code used for "attach" can be copied/modified to load a 
> core dump.
> 
> then you might be able do use the stack, and watches. but I do not know

In this case all I did was (before running program)  ulimit -Hc 
unlimited  followed by (while looking at stuck program)  gcore <pid> 
and then  gdb <binary> core.<pid>  after which I could use bt etc. In 
principle, something similar should work for a program which had failed 
with a bus error or segment violation.

I'm converting somebody else's code from single- to multithreaded. If 
run in the context of Lazarus's own debugging it's fine, but if running 
"unattended" it locks up with a race condition about 75% of the time. So 
being able to look at a snapshot is really extremely useful, even if I 
can't take full control.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list