I
I
injecto2012-05-17 19:55:29
C++ / C#
injecto, 2012-05-17 19:55:29

Debugging a so library loaded with dlopen()?

CentOS 6.2, Qt Creator IDE 2.4.1 (using GNU toolchain).
I decided to attach a trivial plugin system to my fastcgi server. Plugins are loaded from the plugins/ directory using library functions like dlopen().
How to debug a plugin? I put a breakpoint, I start the server in debugging - the point is ignored. gdb problems? Problems with my hands or interaural ganglion?
So far, I'm guessing the following ways:
> maybe I don't provide debug information, so gdb doesn't care
> log the old fashioned way
> don't use the current IDE (gdb often falls off there)
Thanks in advance for adequate answers to a possibly stupid question.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
mejedi, 2012-05-17
@injecto

Check directly in gdb to rule out IDE issues.

D
DmZ, 2012-05-18
@DmZ

1. Without debugging information, the IDE simply cannot link the execution point to the sources, i.e. You can't trace the program visually. Debugging info should be added.
2. Try setting a breakpoint after the plugin's dlopen(), and then setting a breakpoint on a function in the plugin. Since before dlopen () gdb simply will not see the symbols that are loaded by the plugin.

E
EaS, 2012-05-19
@EaS

I'm not exactly sure, but after dlopen I can see how the dll is mapped into memory, and load debugging information, something like this: sourceware.org/glibc/wiki/Debugging/Loader_Debugging
Start reading approximately from info proc mapping.
BUT! I'm pretty sure that this won't be the optimal way, and it can be done in an easier way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question