This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Debugging a shared library through gdbserver
On Wed, Mar 15, 2006 at 02:18:06PM +0800, Nai-Hsien wrote:
> Nobody told me to do this. I just learned add-symbol-file from u-boot
> document to relocate
> program base. I tried some commands in gdb user's manual then I think this
> command has result most
> close to my expectation. Anyway, this is totally my fault.
You don't need to relocate the program by hand when you're debugging in
userspace.
> I tried to follow your hint, shown as blow. Now, I can set a breakpoint in
> the shared library and make
> the program stop there. However, I still can not see the source code. (I am
> using DDD with gdb.)
> Am I still doing something wrong?
>
> Thank you
> Dennis
>
> # my shared library is in lib/
> (gdb) set solib-absolute-prefix lib
That's not what solib-absolute-prefix is for. You need to point it at
the root of a filesystem image that matches the one running on your
target, so that GDB can open <prefix>/lib/ld.so.1 and
<prefix>/usr/lib/libfoo.so. I usually use NFS for this. If you
do that...
> (gdb) file console
> (gdb) target remote 10.0.2.3:2001
> 0x0fd39fac in ?? ()
> warning: Unable to find dynamic linker breakpoint function.
> GDB will be unable to debug shared library initializers
> and track explicitly loaded dynamic code.
This message will go away.
--
Daniel Jacobowitz
CodeSourcery