Louen
Louen

Reputation: 3677

Debugging a dynamically-loaded library in c++ with QtCreator

I am building an application which dynamically loads shared-libraries plugins with qtcreator on linux.

The plugin is built in a separate folder, then copied to the main application plugin folder. The application looks for plugins at startup and loads them.

Both plugin and executable are built in separate CMake projects (in Debug configuration), which are loaded in my qtcreator session.

It seems that the debugger is unable to link the library with the source code files. This has two effects * The breakpoints I put on the plugins files are ignored * If I put a "code breakpoint" (i.e. asm int 3) in the plugin code, the debugger shows me the dissasembly (and not the source).

How can I tell the debugger to look for the right source files ?

Upvotes: 3

Views: 2305

Answers (1)

Funmungus
Funmungus

Reputation: 144

You may set breakpoints in libraries, based on function names and such. To view source code of break points the library must be compiled with debugging symbols (e.g. qmake CONFIG+=debug), and the source code cannot be moved after it is compiled. I believe breaking on file and line numbers also requires the source. If you are still experiencing problems I would try adding the source directory to INCLUDEPATH, or loading both projects in QtCreator at runtime.

Upvotes: 1

Related Questions