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 c
Another example further to lothar's answer:
I'm running tests on a dynamic library test.so
(compiled from test.c
) in Linux using python
and python's unit-testing library unittest
called tests/test_pwmbasic.py
. (naming scheme is a bit monotone, I realise that now)
~/my/test/path/
tests/
__init__.py
test_pwmbasic.py
test.c
test.so
I want to debug what's in test.so
from stimulus in test_pwmbasic.py
.
So this is how I got it working...
$ cd ~/my/test/path
$ gdb $(which python)
... gdb blah ...
(gdb) b test.c:179
(gdb) run
>>> from tests.test_pwmbasic import *
>>> import unittest
>>> unittest.main()
... unittest blah ...
Breakpoint 1, pwmTest_setDutyCycles (dutyCycles=0x7ffff7ece910) at ./test.c:179
(gdb) print pwm_errorCode
$1 = PWM_ERROR_NONE
and now I want to marry gdb
note: test.c
also includes ../pwm.c
, so I can also breakpoint within that library with
(gdb) b pwm.c:123