Guybrush Threepwood
Guybrush Threepwood

Reputation: 3493

how to use gdb to debug a plugin

I am trying to debug, with gdb, a plugin to a program. I saw a question earlier that indicated that the directory command in gdb might help. I thought it would help because, when I try to set a breakpoint within the code of the plugin, I get the error that says: "No source file named..." It didn't seem to do anything when I used the directory command with the source path structure. Any ideas? Thanks.

Upvotes: 1

Views: 1696

Answers (1)

Employed Russian
Employed Russian

Reputation: 213375

"No source file named..."

GDB will not be able to set a breakpoint until your plugin is actually loaded into the inferior (being debugged) process.

Use (gdb) info shared command to check whether your plugin is already loaded or not.

If it isn't, you can set a "deferred" breakpoint (GDB should be asking you whether you want to set such a breakpoint, assuming you have the default set confirm on setting).

If your plugin is already loaded and visible in info shared output, then you haven't built your plugin with debug info. Rebuild it with -g, and you should be able to set breakpoints in it.

Upvotes: 3

Related Questions