[Lazarus] Debugging shared libraries

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Fri Sep 21 09:33:45 CEST 2012


Bernd wrote:
> 2012/9/16 Mark Morgan Lloyd <markMLl.lazarus at telemetry.co.uk>:
> 
>> interesting question: can Lazarus+gdb be persuaded to trace into a shared
>> library?
> 
> While developing the libpurpletorchat plugin (a libpurple plugin) I
> did not notice any problems debugging the library.
> 
> In Lazarus I set /usr/bin/pidgin as host application and then click
> the run button,
> pidgin (written in C) then loads libpurple
> libpurple (also written in C) loads my plugin (library written in Free Pascal)
> 
> all breakpoints worked, callstack worked and stepping through my
> library (and even from there back into libpurple) was no problem at
> all. I did this on Linux/i386, I did not try debugging on windows. I
> did not notice any debugging problems at all due to the fact that it
> is a library instead of a program, it worked exceptionally well.

OK, so presumably /usr/bin/pidgin is loading the plugin at runlime (i.e. 
LoadModule() or whatever) rather than going through a surreptitious 
recompilation.

I'm working on a test program+library which looks at both dynamic 
loading and whether an executable (as distinct from a library) can be 
queried for version information. This doesn't use the LCL etc., and 
unlike what I (think I) saw earlier I do appear to be able to open an 
unrelated binary to get version info out of it. More when I know more.

-- 
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