0

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

tristan
  • 4,235
  • 2
  • 21
  • 45
kidoher
  • 2,297
  • 2
  • 12
  • 19

2 Answers2

1

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

It'sPete
  • 5,083
  • 8
  • 39
  • 72
1

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.

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547