Monitor linux dynamic library

I would like to track (debug) the linux dynamic library written in C.
I want to see when and what parameters are passed to it.

The monitoring library "X" is called by another dynamic library "Y".
Both "X" and "Y" are displayed in / proc / pid / maps of the executable "A".

Using ltrace, lib X or Y was not shown in the executable.
The executable file uses several threads.

Also, when using the ldd command on exec, it says nothing about libs X or Y.
ldd Y, indicates that Y needs X.

Using ldd for all libs, execs in the project does not mention anyone who needs Y.
However, Y seems to load in / proc / pid / maps exec.

I'm not sure what steps I could take to debug the X lib, any tips are welcome.

+4
source share
1 answer

If user756235 can run it under gdb, then this is an approach using this and this . The only question is to make a complete list of functions in the general X library: nm ./libX.so | grep "T " nm ./libX.so | grep "T "

And then create .gdbinit (in my case I control args print_in_lib ):

 host: srv2-x64rh5-01, OS: Linux 2.6.18-238.el5>more .gdbinit file main set pagination off set logging file gdb.txt set breakpoint pending on set logging on b print_in_lib commands info args continue end r set logging off quit 

And when I run gdb :

host: srv2-x64rh5-01, OS: Linux 2.6.18-238.el5> gdb -q The print_in_lib function is undefined. Breakpoint 1 (print_in_lib) is not expected. warning: no downloadable sections were found in the added system DSO symbol file at 0x2aaaaaaabab000 thousand: 1 print_debug: 0

Breakpoint 1, print_in_lib (print_debug = 0, index = 0) in my_lib.cpp: 7 7 if (print_debug) {print_debug = 0 index = 0

Breakpoint 1, print_in_lib (print_debug = 0, index = 1) on my_lib.cpp: 7 7 if (print_debug) {print_debug = 0 index = 1

Breakpoint 1, print_in_lib (print_debug = 0, index = 2) on my_lib.cpp: 7 7 if (print_debug) {print_debug = 0 index = 2

Breakpoint 1, print_in_lib (print_debug = 0, index = 3) to my_lib.cpp: 7 7 if (print_debug) {print_debug = 0 index = 3

+4
source

All Articles