Can anyone tell me how to do runtime debugging on shared libraries?
I need to runtime-debug a function in my shared library, but its called by another program.
How can I do something like dbx with shared libraries?
I m using dbx on AIX.
is gdb better than dbx for what I m trying to do?.
You just need to call gdb with the executable (it does not matter if it is yours or a 3rd party one). Here is an example where I debug the ls command and set a breakpoint in the (shared) c library. This example uses gdb 6.8 which supports deferred (pending) breakpoints which makes this easy:
As you can see gdb automatically manages all threads used by the executable. You don’t have to do anything special for threads there. The breakpoint will work in any thread.
Alternatively if you want to attach the debugger to an already running application (I use tail -f /tmp/ttt here as an example):