Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Trouble remote debugging
@ 2006-02-25 12:48 EJS
  2006-02-25 23:18 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: EJS @ 2006-02-25 12:48 UTC (permalink / raw)
  To: gdb

Hi, 
I am trying to remote debug a hello world program that
was cross compiled on a cygwin host for a linux target
(using crosstool). The problem that I am having is
that the shared libaries are not being handled
correctly by gdb. Specifically, if run gdb on the
target machine my bt looks like:
(gdb) bt
#0  0x006ae7a2 in _dl_sysinfo_int80 () from
/lib/ld-linux.so.2
#1  0x00784253 in __read_nocancel () from
/lib/tls/libc.so.6
#2  0x00729aa8 in _IO_file_read_internal () from
/lib/tls/libc.so.6
#3  0x0072882e in _IO_new_file_underflow () from
/lib/tls/libc.so.6
#4  0x0072ae0b in _IO_default_uflow_internal () from
/lib/tls/libc.so.6
#5  0x0072abfd in __uflow () from /lib/tls/libc.so.6
#6  0x00725c5f in getc () from /lib/tls/libc.so.6
#7  0x080485ed in main () at hello.cpp:10

Whereas when I try the same bt connected remotely
through gdbserver. I get 
(gdb) bt
#0  0x006ae7a2 in ?? ()
#1  0x00784253 in ?? ()
#2  0x007f1ff4 in ?? ()
#3  0x00729aa8 in ?? ()
#4  0x00000000 in ?? ()
#5  0xb7ffe000 in ?? ()
#6  0x00000400 in ?? ()
   from /opt/crosstool/gcc-3.4.4-glibc-2.3.5
-linux-gnu/lib/libstdc++.so.6
#7  0xbffff93c in ?? ()
#8  0x0072882e in ?? ()
#9  0x007f2720 in ?? ()
#10 0xb7ffe000 in ?? ()
#11 0x00000400 in ?? ()
   from /opt/crosstool/gcc-3.4.4-glibc-2.3.5
-linux-gnu/lib/libstdc++.so.6
#12 0x007f1ff4 in ?? ()
#13 0x007f2720 in ?? ()
#14 0xb7fe76c0 in ?? ()
#15 0xbffff94c in ?? ()
#16 0x0072ae0b in ?? ()
#17 0x007f2720 in ?? ()
#18 0x007f2720 in ?? ()
#19 0xbffff964 in ?? ()
#20 0x0072abfd in ?? ()
#21 0x007f2720 in ?? ()
#22 0xbffffa24 in ?? ()
#23 0x007f1ff4 in ?? ()
#24 0x007f2720 in ?? ()
#25 0xbffff978 in ?? ()
#26 0x00725c5f in ?? ()
#27 0x007f2720 in ?? ()
#28 0xbffffa24 in ?? ()
#29 0xbffff9b0 in ?? ()
#30 0xbffff998 in ?? ()
#31 0x080485ed in main () at hello.cpp:10

As far as I know, I have set my solib-search-path
correctly and my shlibs are being found as you can see
from:
(gdb) info share
From        To          Syms Read   Shared Object
Library
0x0003b920  0x000a8dc0  Yes        
/opt/crosstool/gcc-3.4.4-glibc-2.3.5/i686-un
known-linux-gnu/i686-unknown-linux-gnu/lib/libstdc++.so.6
0x00003680  0x0001ac60  Yes        
/opt/crosstool/gcc-3.4.4-glibc-2.3.5/i686-un
known-linux-gnu/i686-unknown-linux-gnu/lib/libm.so.6
0x00001680  0x000065c0  Yes        
/opt/crosstool/gcc-3.4.4-glibc-2.3.5/i686-un
known-linux-gnu/i686-unknown-linux-gnu/lib/libgcc_s.so.1
0x000153d0  0x000ebbbc  Yes        
/opt/crosstool/gcc-3.4.4-glibc-2.3.5/i686-un
known-linux-gnu/i686-unknown-linux-gnu/lib/libc.so.6
0x00000760  0x0000f87f  Yes        
/opt/crosstool/gcc-3.4.4-glibc-2.3.5/i686-un
known-linux-gnu/i686-unknown-linux-gnu/lib/ld-linux.so.2

One thing that I noticed is that the symbol tables for
the cross compiled shlibs are different than the ones
on the target (I checked this via objdump -T). Is this
the problem? If so how do I make them the same?

Thanks,
J

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


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

* Re: Trouble remote debugging
  2006-02-25 12:48 Trouble remote debugging EJS
@ 2006-02-25 23:18 ` Daniel Jacobowitz
  2006-02-27 15:02   ` EJS
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2006-02-25 23:18 UTC (permalink / raw)
  To: EJS; +Cc: gdb

On Fri, Feb 24, 2006 at 05:30:54PM -0800, EJS wrote:
> One thing that I noticed is that the symbol tables for
> the cross compiled shlibs are different than the ones
> on the target (I checked this via objdump -T). Is this
> the problem? If so how do I make them the same?

You _must_ use the same libraries on both sides.  The ones on the
target can be stripped, but that's it - otherwise they must match.

If you are running the program on a prebuilt native target, copy its
libraries to your debug host.  If you want to use the crosstool
libraries, copy them to the appropriate locations on your target.

You will probably want to use solib-absolute-prefix rather than
solib-search-path; see the archives of this list for more information
on that.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Trouble remote debugging
  2006-02-25 23:18 ` Daniel Jacobowitz
@ 2006-02-27 15:02   ` EJS
  2006-02-27 15:07     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: EJS @ 2006-02-27 15:02 UTC (permalink / raw)
  To: gdb



--- Daniel Jacobowitz <drow@false.org> wrote:

> On Fri, Feb 24, 2006 at 05:30:54PM -0800, EJS wrote:
> > One thing that I noticed is that the symbol tables
> for
> > the cross compiled shlibs are different than the
> ones
> > on the target (I checked this via objdump -T). Is
> this
> > the problem? If so how do I make them the same?
> 
> You _must_ use the same libraries on both sides. 
> The ones on the
> target can be stripped, but that's it - otherwise
> they must match.

Daniel, 
Thanks for the response. That is what I thought. So I
guess my next question is why aren't the libs the
same. I thought that that was what crosstool was
supposed to do. (but thats a question for a different
list.)

Regarding solib-search-path vs solib-absolute-prefix,
I was actually setting both. I tried to set the prefix
alone, but some of the libs were in different
locations (eg /lib vs /lib/tls, etc.)

Thanks again,
J


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


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

* Re: Trouble remote debugging
  2006-02-27 15:02   ` EJS
@ 2006-02-27 15:07     ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2006-02-27 15:07 UTC (permalink / raw)
  To: EJS; +Cc: gdb

On Sat, Feb 25, 2006 at 04:48:44AM -0800, EJS wrote:
> Regarding solib-search-path vs solib-absolute-prefix,
> I was actually setting both. I tried to set the prefix
> alone, but some of the libs were in different
> locations (eg /lib vs /lib/tls, etc.)

Then you're using the wrong libs if your target uses /lib/tls and your
host prefix doesn't contain it.  Again, try a crosstool list.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2006-02-25 23:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-25 12:48 Trouble remote debugging EJS
2006-02-25 23:18 ` Daniel Jacobowitz
2006-02-27 15:02   ` EJS
2006-02-27 15:07     ` Daniel Jacobowitz

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