kidoher
kidoher

Reputation: 2357

How to debug the .so source?

I want to know how to debug the inner source of a so file. I have a so file,and i use dlopen() to open it,then I use dlsym() to load the method. Now,I use g++ tools with the flag -g to compile it.It works very well, however I can't step into the so source by using the gdb command 'next'.

Upvotes: 0

Views: 678

Answers (2)

If all the code is compiled with -g (and that includes the code of the dlopen-ed shared object .so file and all the code of the main dlopen-ing program), then you can step into a function of your plugin with gdb (or even add a breakpoint inside).

It may be useful to use quite recent versions of the GCC compiler (e.g. 4.8) and of the GDB debugger (i.e. 7.6). Both have improved significantly and recently on these aspects.

Upvotes: 1

It'sPete
It'sPete

Reputation: 5221

You seem to be confusing two different ways of running gdb. Here's a link explaining how to iterate over your source code.

http://sourceware.org/gdb/onlinedocs/gdb/Continuing-and-Stepping.html

Upvotes: 1

Related Questions