Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* loading shared library
@ 2003-01-27  9:56 Frank van Eijkelenburg
  2003-01-27 10:38 ` Frank van Eijkelenburg
  0 siblings, 1 reply; 6+ messages in thread
From: Frank van Eijkelenburg @ 2003-01-27  9:56 UTC (permalink / raw)
  To: Gnu Debugger mailing list

Hi all,

I've a linux machine with RedHat installed with linux kernel 2.4.7. GDB 5.3
is running. I crosscompiled the gdbserver for an ARM platform (with linux
2.4.16-rmk2). when I try to debug a simple multithreaded program, I get an
error when loading the shared libraries:

(gdb) info sharedlibrary
From        To          Syms Read   Shared Object Library
0x40023020  0x4002c35c  No          /lib/libpthread.so.0
0x40054400  0x401563d0  No          /lib/libc.so.6
0x40001e50  0x40012e80  No          /lib/ld-linux.so.2
(gdb) sharedlibrary
Reading symbols from /lib/libpthread.so.0...done.
Ignoring packet error, continuing...
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/libc.so.6...done.
Error while reading shared library symbols:
putpkt: write failed: Broken pipe.
Reading symbols from /lib/ld-linux.so.2...done.
Error while reading shared library symbols:
putpkt: write failed: Broken pipe.
putpkt: write failed: Broken pipe.
(gdb)

At the target side, I've a segmentation fault. The simple program is linked
against an unstripped libpthread. This library exists at the target. The
only possible problem in my opinion, is that gdbserver is linked against
libthread_db which itself is compiled against libc 2.2.4 while the target is
working with libc 2.1.3. Could this be a problem, or is it something else
what causes this behaviour???

Thanx,
Frank



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

* RE: loading shared library
  2003-01-27  9:56 loading shared library Frank van Eijkelenburg
@ 2003-01-27 10:38 ` Frank van Eijkelenburg
  2003-01-27 16:05   ` Kevin Buettner
  0 siblings, 1 reply; 6+ messages in thread
From: Frank van Eijkelenburg @ 2003-01-27 10:38 UTC (permalink / raw)
  To: frank.van.eijkelenburg, Gnu Debugger mailing list

> Hi all,
>
> I've a linux machine with RedHat installed with linux kernel
> 2.4.7. GDB 5.3
> is running. I crosscompiled the gdbserver for an ARM platform (with linux
> 2.4.16-rmk2). when I try to debug a simple multithreaded program, I get an
> error when loading the shared libraries:
>
> (gdb) info sharedlibrary
> From        To          Syms Read   Shared Object Library
> 0x40023020  0x4002c35c  No          /lib/libpthread.so.0
> 0x40054400  0x401563d0  No          /lib/libc.so.6
> 0x40001e50  0x40012e80  No          /lib/ld-linux.so.2
> (gdb) sharedlibrary
> Reading symbols from /lib/libpthread.so.0...done.
> Ignoring packet error, continuing...
> Loaded symbols for /lib/libpthread.so.0
> Reading symbols from /lib/libc.so.6...done.
> Error while reading shared library symbols:
> putpkt: write failed: Broken pipe.
> Reading symbols from /lib/ld-linux.so.2...done.
> Error while reading shared library symbols:
> putpkt: write failed: Broken pipe.
> putpkt: write failed: Broken pipe.
> (gdb)
>
> At the target side, I've a segmentation fault. The simple program
> is linked
> against an unstripped libpthread. This library exists at the target. The
> only possible problem in my opinion, is that gdbserver is linked against
> libthread_db which itself is compiled against libc 2.2.4 while
> the target is
> working with libc 2.1.3. Could this be a problem, or is it something else
> what causes this behaviour???
>
> Thanx,
> Frank

I found out that only libpthread is giving problems (I can load the other
two libraries without any problem). When I rename the libpthread library (in
/lib) at the HOST, gdb is giving the following error message:

(gdb) info sharedlibrary
Error while mapping shared library sections:
/lib/libpthread.so.0: No such file or directory.
From        To          Syms Read   Shared Object Library
                        No          /lib/libpthread.so.0
0x40054400  0x401563d0  No          /lib/libc.so.6
0x40001e50  0x40012e80  No          /lib/ld-linux.so.2
(gdb) sharedlibrary
Error while reading shared library symbols:
/lib/libpthread.so.0: No such file or directory.
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
(gdb)

I don't understand why gdb tries to load a library from the host
(/lib/libpthread.so.0), while it needs the crosscompiled library from the
target. Or do I misunderstand something?

Frank


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

* Re: loading shared library
  2003-01-27 10:38 ` Frank van Eijkelenburg
@ 2003-01-27 16:05   ` Kevin Buettner
  2003-01-31  9:55     ` Frank van Eijkelenburg
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Buettner @ 2003-01-27 16:05 UTC (permalink / raw)
  To: frank.van.eijkelenburg, Gnu Debugger mailing list

On Jan 27, 11:38am, Frank van Eijkelenburg wrote:

> I don't understand why gdb tries to load a library from the host
> (/lib/libpthread.so.0), while it needs the crosscompiled library from the
> target. Or do I misunderstand something?

You need to tell GDB where to find the shared libraries for the target.
Use the ``set solib-absolute-prefix ...'' command to do this.

Kevin


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

* RE: loading shared library
  2003-01-27 16:05   ` Kevin Buettner
@ 2003-01-31  9:55     ` Frank van Eijkelenburg
  2003-01-31 10:39       ` Kevin Buettner
  0 siblings, 1 reply; 6+ messages in thread
From: Frank van Eijkelenburg @ 2003-01-31  9:55 UTC (permalink / raw)
  To: Kevin Buettner, Gnu Debugger mailing list

> -----Original Message-----
> From: Kevin Buettner [mailto:kevinb@redhat.com]
> Sent: maandag 27 januari 2003 17:06
> To: frank.van.eijkelenburg@technolution.nl; Gnu Debugger mailing list
> Subject: Re: loading shared library
>
>
> On Jan 27, 11:38am, Frank van Eijkelenburg wrote:
>
> > I don't understand why gdb tries to load a library from the host
> > (/lib/libpthread.so.0), while it needs the crosscompiled
> library from the
> > target. Or do I misunderstand something?
>
> You need to tell GDB where to find the shared libraries for the target.
> Use the ``set solib-absolute-prefix ...'' command to do this.
>
> Kevin

I tried this, and it was working. At this moment I've upgraded my glibc on
the target from 2.1.3 to 2.2.4. I also build a complete toolchain with glibc
2.2.4. Now I want to debug a simple multithreaded program remote. But the
following occured:

GNU gdb 5.3
Copyright 2002 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"...
0x40002a70 in ?? ()
(gdb) b 20
Breakpoint 1 at 0x8590: file ex1.c, line 20.
(gdb) c
Continuing.

Breakpoint 1, main () at ex1.c:26
26        retcode = pthread_create(&th_a, NULL, process, (void *) "a");
(gdb) sharedlibrary
Reading symbols from /usr/arm/tools/arm-linux/lib/libpthread.so.0...done.
Ignoring packet error, continuing...
Loaded symbols for /usr/arm/tools/arm-linux/lib/libpthread.so.0
Reading symbols from /usr/arm/tools/arm-linux/lib/libc.so.6...done.
Error while reading shared library symbols:
putpkt: write failed: Broken pipe.
Reading symbols from /usr/arm/tools/arm-linux/lib/ld-linux.so.2...done.
Error while reading shared library symbols:
putpkt: write failed: Broken pipe.
putpkt: write failed: Broken pipe.
(gdb) show solib-absolute-prefix
Prefix for loading absolute shared library symbol files is "/dev/null".
(gdb) show solib-
solib-absolute-prefix  solib-search-path
(gdb) show solib-search-path
The search path for loading non-absolute shared library symbol files is
"/usr/arm/tools/arm-linux/lib".
(gdb)

It's trying to load the right libraries, but fails on libpthread (I can load
the other two without any problems). Any idea of what's causing the
problem???

Frank


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

* Re: loading shared library
  2003-01-31  9:55     ` Frank van Eijkelenburg
@ 2003-01-31 10:39       ` Kevin Buettner
  2003-01-31 10:53         ` Frank van Eijkelenburg
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Buettner @ 2003-01-31 10:39 UTC (permalink / raw)
  To: Gnu Debugger mailing list, frank.van.eijkelenburg

On Jan 31, 10:55am, Frank van Eijkelenburg wrote:
> Subject: RE: loading shared library
> > -----Original Message-----
> > From: Kevin Buettner [mailto:kevinb@redhat.com]
> > Sent: maandag 27 januari 2003 17:06
> > To: frank.van.eijkelenburg@technolution.nl; Gnu Debugger mailing list
> > Subject: Re: loading shared library
> >
> >
> > On Jan 27, 11:38am, Frank van Eijkelenburg wrote:
> >
> > > I don't understand why gdb tries to load a library from the host
> > > (/lib/libpthread.so.0), while it needs the crosscompiled
> > library from the
> > > target. Or do I misunderstand something?
> >
> > You need to tell GDB where to find the shared libraries for the target.
> > Use the ``set solib-absolute-prefix ...'' command to do this.
> >
> > Kevin
> 
> I tried this, and it was working. At this moment I've upgraded my glibc on
> the target from 2.1.3 to 2.2.4. I also build a complete toolchain with glibc
> 2.2.4. Now I want to debug a simple multithreaded program remote. But the
> following occured:
> 
> GNU gdb 5.3
> Copyright 2002 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"...
> 0x40002a70 in ?? ()
> (gdb) b 20
> Breakpoint 1 at 0x8590: file ex1.c, line 20.
> (gdb) c
> Continuing.
> 
> Breakpoint 1, main () at ex1.c:26
> 26        retcode = pthread_create(&th_a, NULL, process, (void *) "a");
> (gdb) sharedlibrary
> Reading symbols from /usr/arm/tools/arm-linux/lib/libpthread.so.0...done.
> Ignoring packet error, continuing...
> Loaded symbols for /usr/arm/tools/arm-linux/lib/libpthread.so.0
> Reading symbols from /usr/arm/tools/arm-linux/lib/libc.so.6...done.
> Error while reading shared library symbols:
> putpkt: write failed: Broken pipe.
> Reading symbols from /usr/arm/tools/arm-linux/lib/ld-linux.so.2...done.
> Error while reading shared library symbols:
> putpkt: write failed: Broken pipe.
> putpkt: write failed: Broken pipe.
> (gdb) show solib-absolute-prefix
> Prefix for loading absolute shared library symbol files is "/dev/null".
> (gdb) show solib-
> solib-absolute-prefix  solib-search-path
> (gdb) show solib-search-path
> The search path for loading non-absolute shared library symbol files is
> "/usr/arm/tools/arm-linux/lib".
> (gdb)
> 
> It's trying to load the right libraries, but fails on libpthread (I can load
> the other two without any problems). Any idea of what's causing the
> problem???

Check the following:

1) That libthread_db.so on the target is from the new glibc.

2) That your gdbserver (or rda) is built with the libthread_db.so from
   the new glibc.  (This is kind of a long shot - so long as it's not
   statically linked it probably shouldn't matter.)
   
3) That libpthread.so on target and host (as found in 
   /usr/arm/tools/arm-linux/lib/libpthread.so.0) are the same.

Kevin


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

* RE: loading shared library
  2003-01-31 10:39       ` Kevin Buettner
@ 2003-01-31 10:53         ` Frank van Eijkelenburg
  0 siblings, 0 replies; 6+ messages in thread
From: Frank van Eijkelenburg @ 2003-01-31 10:53 UTC (permalink / raw)
  To: Kevin Buettner, Gnu Debugger mailing list

> > I tried this, and it was working. At this moment I've upgraded
> my glibc on
> > the target from 2.1.3 to 2.2.4. I also build a complete
> toolchain with glibc
> > 2.2.4. Now I want to debug a simple multithreaded program
> remote. But the
> > following occured:
> >
> > GNU gdb 5.3
> > Copyright 2002 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"...
> > 0x40002a70 in ?? ()
> > (gdb) b 20
> > Breakpoint 1 at 0x8590: file ex1.c, line 20.
> > (gdb) c
> > Continuing.
> >
> > Breakpoint 1, main () at ex1.c:26
> > 26        retcode = pthread_create(&th_a, NULL, process, (void *) "a");
> > (gdb) sharedlibrary
> > Reading symbols from
> /usr/arm/tools/arm-linux/lib/libpthread.so.0...done.
> > Ignoring packet error, continuing...
> > Loaded symbols for /usr/arm/tools/arm-linux/lib/libpthread.so.0
> > Reading symbols from /usr/arm/tools/arm-linux/lib/libc.so.6...done.
> > Error while reading shared library symbols:
> > putpkt: write failed: Broken pipe.
> > Reading symbols from /usr/arm/tools/arm-linux/lib/ld-linux.so.2...done.
> > Error while reading shared library symbols:
> > putpkt: write failed: Broken pipe.
> > putpkt: write failed: Broken pipe.
> > (gdb) show solib-absolute-prefix
> > Prefix for loading absolute shared library symbol files is "/dev/null".
> > (gdb) show solib-
> > solib-absolute-prefix  solib-search-path
> > (gdb) show solib-search-path
> > The search path for loading non-absolute shared library symbol files is
> > "/usr/arm/tools/arm-linux/lib".
> > (gdb)
> >
> > It's trying to load the right libraries, but fails on
> libpthread (I can load
> > the other two without any problems). Any idea of what's causing the
> > problem???
>
> Check the following:
>
> 1) That libthread_db.so on the target is from the new glibc.
>
> 2) That your gdbserver (or rda) is built with the libthread_db.so from
>    the new glibc.  (This is kind of a long shot - so long as it's not
>    statically linked it probably shouldn't matter.)
>
> 3) That libpthread.so on target and host (as found in
>    /usr/arm/tools/arm-linux/lib/libpthread.so.0) are the same.
>
> Kevin

Thank you very much, it was point 3. I had on my target another libpthread
as on the host. However, both were libpthread-0.9.so (from glibc 2.2.4). But
I saw difference in the filesize.

Frank


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

end of thread, other threads:[~2003-01-31 10:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-27  9:56 loading shared library Frank van Eijkelenburg
2003-01-27 10:38 ` Frank van Eijkelenburg
2003-01-27 16:05   ` Kevin Buettner
2003-01-31  9:55     ` Frank van Eijkelenburg
2003-01-31 10:39       ` Kevin Buettner
2003-01-31 10:53         ` Frank van Eijkelenburg

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