Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* shared library symbols not loaded automatically
@ 2006-07-12 18:12 Kunal Parmar
  2006-07-12 18:15 ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Kunal Parmar @ 2006-07-12 18:12 UTC (permalink / raw)
  To: gdb

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: shared library symbols not loaded automatically
  2006-07-12 18:12 shared library symbols not loaded automatically Kunal Parmar
@ 2006-07-12 18:15 ` Daniel Jacobowitz
  2006-07-21 16:14   ` Kunal Parmar
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2006-07-12 18:15 UTC (permalink / raw)
  To: Kunal Parmar; +Cc: gdb

On Wed, Jul 12, 2006 at 11:37:25PM +0530, Kunal Parmar wrote:
> 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.

It looks like you need to set solib-absolute-prefix.

> >Reading symbols from /lib/libc.so.6...done.
> >Loaded symbols for /lib/libc.so.6

This is probably loading your system's /lib/libc.so.6.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: shared library symbols not loaded automatically
  2006-07-12 18:15 ` Daniel Jacobowitz
@ 2006-07-21 16:14   ` Kunal Parmar
  2006-07-22 20:09     ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Kunal Parmar @ 2006-07-21 16:14 UTC (permalink / raw)
  To: gdb

Hi Daniel,
I am not clear how setting solib-absolute-prefix will solve this problem.
The manual says that it is used as a prefix for searching the libraries 
at runtime.
When I use the command sharedlibrary at the gdb prompt, the libraries 
are correctly loaded.
Doesn't this mean that I do not need to set the solib-absolute-prefix??

Daniel Jacobowitz wrote:
> On Wed, Jul 12, 2006 at 11:37:25PM +0530, Kunal Parmar wrote:
>   
>> 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.
>>     
>
> It looks like you need to set solib-absolute-prefix.
>
>   
>>> Reading symbols from /lib/libc.so.6...done.
>>> Loaded symbols for /lib/libc.so.6
>>>       
>
> This is probably loading your system's /lib/libc.so.6.
>
>   

-- 
Kunal Parmar
Software Developer,
Codito Technologies Pvt. Ltd. (www.codito.com)

Office: +91 20 26051367 ext. 133
Mobile: +91 98230 28171


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: shared library symbols not loaded automatically
  2006-07-21 16:14   ` Kunal Parmar
@ 2006-07-22 20:09     ` Daniel Jacobowitz
  2006-07-22 21:07       ` Paul Koning
  2006-07-23 22:36       ` Kunal Parmar
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2006-07-22 20:09 UTC (permalink / raw)
  To: Kunal Parmar; +Cc: gdb

On Fri, Jul 21, 2006 at 08:12:56PM +0530, Kunal Parmar wrote:
> Hi Daniel,
> I am not clear how setting solib-absolute-prefix will solve this problem.
> The manual says that it is used as a prefix for searching the libraries 
> at runtime.
> When I use the command sharedlibrary at the gdb prompt, the libraries 
> are correctly loaded.
> Doesn't this mean that I do not need to set the solib-absolute-prefix??

Not if they're the wrong libraries.

You may be loading literally "/lib/libc.so.6" on your host - an
i386 library.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: shared library symbols not loaded automatically
  2006-07-22 20:09     ` Daniel Jacobowitz
@ 2006-07-22 21:07       ` Paul Koning
  2006-07-22 23:17         ` Daniel Jacobowitz
  2006-07-23 22:36       ` Kunal Parmar
  1 sibling, 1 reply; 7+ messages in thread
From: Paul Koning @ 2006-07-22 21:07 UTC (permalink / raw)
  To: drow; +Cc: gdb

>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:

 Daniel> On Fri, Jul 21, 2006 at 08:12:56PM +0530, Kunal Parmar wrote:
 >> Hi Daniel, I am not clear how setting solib-absolute-prefix will
 >> solve this problem.  The manual says that it is used as a prefix
 >> for searching the libraries at runtime.  When I use the command
 >> sharedlibrary at the gdb prompt, the libraries are correctly
 >> loaded.  Doesn't this mean that I do not need to set the
 >> solib-absolute-prefix??

 Daniel> Not if they're the wrong libraries.

 Daniel> You may be loading literally "/lib/libc.so.6" on your host -
 Daniel> an i386 library.

It would be a good feature if GDB didn't do that for crossbuilds,
because it can't possibly be correct...

	paul


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: shared library symbols not loaded automatically
  2006-07-22 21:07       ` Paul Koning
@ 2006-07-22 23:17         ` Daniel Jacobowitz
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2006-07-22 23:17 UTC (permalink / raw)
  To: Paul Koning; +Cc: gdb

On Sat, Jul 22, 2006 at 04:38:26PM -0400, Paul Koning wrote:
> >>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:
> 
>  Daniel> On Fri, Jul 21, 2006 at 08:12:56PM +0530, Kunal Parmar wrote:
>  >> Hi Daniel, I am not clear how setting solib-absolute-prefix will
>  >> solve this problem.  The manual says that it is used as a prefix
>  >> for searching the libraries at runtime.  When I use the command
>  >> sharedlibrary at the gdb prompt, the libraries are correctly
>  >> loaded.  Doesn't this mean that I do not need to set the
>  >> solib-absolute-prefix??
> 
>  Daniel> Not if they're the wrong libraries.
> 
>  Daniel> You may be loading literally "/lib/libc.so.6" on your host -
>  Daniel> an i386 library.
> 
> It would be a good feature if GDB didn't do that for crossbuilds,
> because it can't possibly be correct...

Yes, I agree.  I invite you to implement it before I get around to it
:-)

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: shared library symbols not loaded automatically
  2006-07-22 20:09     ` Daniel Jacobowitz
  2006-07-22 21:07       ` Paul Koning
@ 2006-07-23 22:36       ` Kunal Parmar
  1 sibling, 0 replies; 7+ messages in thread
From: Kunal Parmar @ 2006-07-23 22:36 UTC (permalink / raw)
  To: gdb

Hi,
No it is the correct libc. Debugging works normally after the libraries 
are loaded.

Daniel Jacobowitz wrote:
> On Fri, Jul 21, 2006 at 08:12:56PM +0530, Kunal Parmar wrote:
>   
>> Hi Daniel,
>> I am not clear how setting solib-absolute-prefix will solve this problem.
>> The manual says that it is used as a prefix for searching the libraries 
>> at runtime.
>> When I use the command sharedlibrary at the gdb prompt, the libraries 
>> are correctly loaded.
>> Doesn't this mean that I do not need to set the solib-absolute-prefix??
>>     
>
> Not if they're the wrong libraries.
>
> You may be loading literally "/lib/libc.so.6" on your host - an
> i386 library.
>
>   

-- 
Kunal Parmar
Software Developer
Codito Technologies Pvt. Ltd. (http://www.codito.com)


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-07-22 23:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-12 18:12 shared library symbols not loaded automatically Kunal Parmar
2006-07-12 18:15 ` Daniel Jacobowitz
2006-07-21 16:14   ` Kunal Parmar
2006-07-22 20:09     ` Daniel Jacobowitz
2006-07-22 21:07       ` Paul Koning
2006-07-22 23:17         ` Daniel Jacobowitz
2006-07-23 22:36       ` Kunal Parmar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox