shared library symbols not loaded automatically

Kunal Parmar
2006-07-12T18:12:58Z

Hello,
I am trying to debug a program which uses shared libraries.
My host is i386-linux and target is arm-linux.
While debugging, gdb shows me the shared libraries used by my program
but it does not load the symbols automatically (auto-solib-add is set).
I have to explicitly use the sharedlibrary command after which the shared
library symbols are read in.

Here is the GDB session -

> GNU gdb 6.3
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and
> you are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for
> details.
> This GDB was configured as "--host=i686-pc-linux-gnu
> --target=arm-linux"...
> (gdb) target remote 192.168.100.226:7777
> Remote debugging using 192.168.100.226:7777
> 0x40000b10 in ?? ()
> (gdb) b main
> Breakpoint 1 at 0x85f4: file foo.c, line 5.
> (gdb) c
> Continuing.
>
> Breakpoint 1, main () at foo.c:5
> 5 printf("%d\n", add(3,4));
> (gdb) info sharedlibrary
> From To Syms Read Shared Object Library
> 0x4001e66c 0x4001e810 No ./libadd.so
> 0x40027640 0x400277d0 No ./libsub.so
> 0x40045170 0x40122328 No /lib/libc.so.6
> 0x40157800 0x4015e3ec No /lib/libgcc_s.so.1
> 0x40000770 0x4001117f No /lib/ld-linux.so.2
> (gdb) show auto-solib-add
> Autoloading of shared library symbols is on.
> (gdb) sharedlibrary
> Reading symbols from /home/kunal/tmp/overflow/libadd.so...done.
> Loaded symbols for ./libadd.so
> Reading symbols from /home/kunal/tmp/overflow/libsub.so...done.
> Loaded symbols for ./libsub.so
> Reading symbols from /lib/libc.so.6...done.
> Loaded symbols for /lib/libc.so.6
> Reading symbols from /lib/libgcc_s.so.1...done.
> Loaded symbols for /lib/libgcc_s.so.1
> Reading symbols from /lib/ld-linux.so.2...done.
> Loaded symbols for /lib/ld-linux.so.2
> (gdb) info sharedlibrary
> From To Syms Read Shared Object Library
> 0x4001e66c 0x4001e810 Yes ./libadd.so
> 0x40027640 0x400277d0 Yes ./libsub.so
> 0x40045170 0x40122328 Yes /lib/libc.so.6
> 0x40157800 0x4015e3ec Yes /lib/libgcc_s.so.1
> 0x40000770 0x4001117f Yes /lib/ld-linux.so.2
> (gdb)

I want the shared library symbols to be read in automatically. Any help
will be appreciated.

Regards,
Kunal Parmar