Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* cross debug glibc loader problem
@ 2010-02-10 12:09 Amker.Cheng
  2010-02-10 19:45 ` Matt Rice
  0 siblings, 1 reply; 6+ messages in thread
From: Amker.Cheng @ 2010-02-10 12:09 UTC (permalink / raw)
  To: gdb

[-- Attachment #1: Type: text/plain, Size: 962 bytes --]

Hi all:
  I am trying to debug glibc loader, e.g. ld.so.
I am following instructions at
http://sources.redhat.com/glibc/wiki/Debugging/Loader_Debugging,
the only difference is the cross debugging by running gdbserver from a
mips simulator.
the start up command is :
------------------------------
EGLIBC=/home/user/working-dir/eglibc-test/build/glibc
mipsel-linux-gnu-gdbserver --debug 192.168.10.2:3333 \
$EGLIBC/elf/ld.so.1
"--library-path
$EGLIBC:\
$EGLIBC/math:\
$EGLIBC/elf:\
$EGLIBC/dlfcn:\
$EGLIBC/nss:\
$EGLIBC/nis:\
$EGLIBC/rt:\
$EGLIBC/resolv:\
$EGLIBC/crypt:\
$EGLIBC/nptl \
$EGLIBC/string/tester

then I trying to connect gdbserver in gdb command line by :

target remote 192.168.10.2:3333

strangely, gdb complains that it :"Cannot access memory at address 0x32a14".

I have totally no idea about this question, so please help and any
tips will be appreciated.

Thanks very much.

the remote log file is attached, hoping helpful:

-- 
Best Regards.

[-- Attachment #2: log.txt --]
[-- Type: text/plain, Size: 5485 bytes --]


w $qSupported#37
r +$PacketSize=7cf;QPassSignals+;qXfer:libraries:read+;qXfer:auxv:read+;qXfer:features:read+#a3
w +$qXfer:features:read:target.xml:0,7ca#46
r +$l<?xml version="1.0"?>\n<!-- Copyright (C) 2007, 2008 Free Software Foundation, Inc.\n\n *!Copying and distribution of this file, with or without modification,\n *!are permitted in any medium without royalty provided the copyright\n *!notice and this notice are preserved.  -->\n\n<!DOCTYPE target SYSTEM "gdb-target.dtd">\n<target>\n  <architecture>mips</architecture>\n  <xi:include href="mips-cpu.xml"/>\n  <xi:include href="mips-cp0.xml"/>\n  <xi:include href="mips-fpu.xml"/>\n\n  <feature name="org.gnu.gdb.mips.linux">\n * <reg name="restart" bitsize="32" group="system"/>\n  </feature>\n</target>\n#4d
w +$qXfer:features:read:mips-cpu.xml:0,7ca#ed
r +$l<?xml version="1.0"?>\n<!-- Copyright (C) 2007, 2008 Free Software Foundation, Inc.\n\n *!Copying and distribution of this file, with or without modification,\n *!are permitted in any medium without royalty provided the copyright\n *!notice and this notice are preserved.  -->\n\n<!DOCTYPE feature SYSTEM "gdb-target.dtd">\n<feature name="org.gnu.gdb.mips.cpu">\n  <reg name="r0" bitsize="32" regnum="0"/>\n  <reg name="r1" bitsize="32"/>\n  <reg name="r2" bitsize="32"/>\n  <reg name="r3" bitsize="32"/>\n  <reg name="r4" bitsize="32"/>\n  <reg name="r5" bitsize="32"/>\n  <reg name="r6" bitsize="32"/>\n  <reg name="r7" bitsize="32"/>\n  <reg name="r8" bitsize="32"/>\n  <reg name="r9" bitsize="32"/>\n  <reg name="r10" bitsize="32"/>\n  <reg name="r11" bitsize="32"/>\n  <reg name="r12" bitsize="32"/>\n  <reg name="r13" bitsize="32"/>\n  <reg name="r14" bitsize="32"/>\n  <reg name="r15" bitsize="32"/>\n  <reg name="r16" bitsize="32"/>\n  <reg name="r17" bitsize="32"/>\n  <reg name="r18" bitsize="32"/>\n  <reg name="r19" bitsize="32"/>\n  <reg name="r20" bitsize="32"/>\n  <reg name="r21" bitsize="32"/>\n  <reg name="r22" bitsize="32"/>\n  <reg name="r23" bitsize="32"/>\n  <reg name="r24" bitsize="32"/>\n  <reg name="r25" bitsize="32"/>\n  <reg name="r26" bitsize="32"/>\n  <reg name="r27" bitsize="32"/>\n  <reg name="r28" bitsize="32"/>\n  <reg name="r29" bitsize="32"/>\n  <reg name="r30" bitsize="32"/>\n  <reg name="r31" bitsize="32"/>\n\n  <reg name="lo" bitsize="32" regnum="33"/>\n  <reg name="hi" bitsize="32" regnum="34"/>\n  <reg name="pc" bitsize="32" regnum="37"/>\n</feature>\n#be
w +$qXfer:features:read:mips-cp0.xml:0,7ca#a8
r +$l<?xml version="1.0"?>\n<!-- Copyright (C) 2007, 2008 Free Software Foundation, Inc.\n\n *!Copying and distribution of this file, with or without modification,\n *!are permitted in any medium without royalty provided the copyright\n *!notice and this notice are preserved.  -->\n\n<!DOCTYPE feature SYSTEM "gdb-target.dtd">\n<feature name="org.gnu.gdb.mips.cp0">\n  <reg name="status" bitsize="32" regnum="32"/>\n  <reg name="badvaddr" bitsize="32" regnum="35"/>\n  <reg name="cause" bitsize="32" regnum="36"/>\n</feature>\n#11
w +$qXfer:features:read:mips-fpu.xml:0,7ca#f0
r +$m<?xml version="1.0"?>\n<!-- Copyright (C) 2007, 2008 Free Software Foundation, Inc.\n\n *!Copying and distribution of this file, with or without modification,\n *!are permitted in any medium without royalty provided the copyright\n *!notice and this notice are preserved.  -->\n\n<!DOCTYPE feature SYSTEM "gdb-target.dtd">\n<feature name="org.gnu.gdb.mips.fpu">\n  <reg name="f0" bitsize="32" type="ieee_single" regnum="38"/>\n  <reg name="f1" bitsize="32" type="ieee_single"/>\n  <reg name="f2" bitsize="32" type="ieee_single"/>\n  <reg name="f3" bitsize="32" type="ieee_single"/>\n  <reg name="f4" bitsize="32" type="ieee_single"/>\n  <reg name="f5" bitsize="32" type="ieee_single"/>\n  <reg name="f6" bitsize="32" type="ieee_single"/>\n  <reg name="f7" bitsize="32" type="ieee_single"/>\n  <reg name="f8" bitsize="32" type="ieee_single"/>\n  <reg name="f9" bitsize="32" type="ieee_single"/>\n  <reg name="f10" bitsize="32" type="ieee_single"/>\n  <reg name="f11" bitsize="32" type="ieee_single"/>\n  <reg name="f12" bitsize="32" type="ieee_single"/>\n  <reg name="f13" bitsize="32" type="ieee_single"/>\n  <reg name="f14" bitsize="32" type="ieee_single"/>\n  <reg name="f15" bitsize="32" type="ieee_single"/>\n  <reg name="f16" bitsize="32" type="ieee_single"/>\n  <reg name="f17" bitsize="32" type="ieee_single"/>\n  <reg name="f18" bitsize="32" type="ieee_single"/>\n  <reg name="f19" bitsize="32" type="ieee_single"/>\n  <reg name="f20" bitsize="32" type="ieee_single"/>\n  <reg name="f21" bitsize="32" type="ieee_single"/>\n  <reg name="f22" bitsize="32" type="ieee_single"/>\n  <reg name="f23" bitsize="32" type="ieee_single"/>\n  <reg name="f24" bitsize="32" type="ieee_single"/>\n  <reg name="f25" bitsize="32" type="ieee_single"/>\n  <reg name="f26" bitsize="32" type="ieee_single"/>\n  <reg name="f27" bitsize="32" type="ieee_single"/>\n  <reg name="f28" bitsize="32" type="ieee_single"/>\n  <reg name="f29" bitsize="32" type="ieee_single"/>\n  <reg name="f30" bitsize="32" type="ieee_single"/>\n  <reg name="f31" bi#50
w +$qXfer:features:read:mips-fpu.xml:7ca,7ca#bb
r +$ltsize="32" type="ieee_single"/>\n\n  <reg name="fcsr" bitsize="32" group="float"/>\n  <reg name="fir" bitsize="32" group="float"/>\n</feature>\n#1a
w ++$?#3f
r +$T051d:3062a97f;25:40085* ;thread:2e39;#dc
w +$Hc-1#09
r +$OK#9a
w +$qC#b4
r +$QC2e39#97
w +$qOffsets#4b
r +$#00
w +$m32a14,4#f8
r +$E01#a6
w +
End of log


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

* Re: cross debug glibc loader problem
  2010-02-10 12:09 cross debug glibc loader problem Amker.Cheng
@ 2010-02-10 19:45 ` Matt Rice
  2010-02-11  3:12   ` Amker.Cheng
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Rice @ 2010-02-10 19:45 UTC (permalink / raw)
  To: Amker.Cheng; +Cc: gdb

On Wed, Feb 10, 2010 at 4:09 AM, Amker.Cheng <amker.cheng@gmail.com> wrote:
> Hi all:
>  I am trying to debug glibc loader, e.g. ld.so.
> I am following instructions at
> http://sources.redhat.com/glibc/wiki/Debugging/Loader_Debugging,
> the only difference is the cross debugging by running gdbserver from a
> mips simulator.
> the start up command is :
> ------------------------------
> EGLIBC=/home/user/working-dir/eglibc-test/build/glibc
> mipsel-linux-gnu-gdbserver --debug 192.168.10.2:3333 \
> $EGLIBC/elf/ld.so.1
> "--library-path
> $EGLIBC:\
> $EGLIBC/math:\
> $EGLIBC/elf:\
> $EGLIBC/dlfcn:\
> $EGLIBC/nss:\
> $EGLIBC/nis:\
> $EGLIBC/rt:\
> $EGLIBC/resolv:\
> $EGLIBC/crypt:\
> $EGLIBC/nptl \
> $EGLIBC/string/tester
>
> then I trying to connect gdbserver in gdb command line by :
>
> target remote 192.168.10.2:3333
>
> strangely, gdb complains that it :"Cannot access memory at address 0x32a14".
>
> I have totally no idea about this question, so please help and any
> tips will be appreciated.
>
> Thanks very much.
>
> the remote log file is attached, hoping helpful:

I would try it out with gdb from cvs, and if that doesn't work
investigate Jan Kratochvil's recent PIE: series of threads on the
gdb-patches list (at least some of which have been integrated), as I
am lead to believe from the first thread in the series that those
patches covered debugging ld.so.


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

* Re: cross debug glibc loader problem
  2010-02-10 19:45 ` Matt Rice
@ 2010-02-11  3:12   ` Amker.Cheng
  2010-02-11 20:59     ` Matt Rice
  0 siblings, 1 reply; 6+ messages in thread
From: Amker.Cheng @ 2010-02-11  3:12 UTC (permalink / raw)
  To: Matt Rice, gdb

On Thu, Feb 11, 2010 at 3:45 AM, Matt Rice <ratmice@gmail.com> wrote:
> On Wed, Feb 10, 2010 at 4:09 AM, Amker.Cheng <amker.cheng@gmail.com> wrote:

>
> I would try it out with gdb from cvs, and if that doesn't work
> investigate Jan Kratochvil's recent PIE: series of threads on the
> gdb-patches list (at least some of which have been integrated), as I
> am lead to believe from the first thread in the series that those
> patches covered debugging ld.so.
>
Thanks, but I trid gdb-7.0.1 in two ways, both facing the same problem:

1 : cross debug using gdb-7.0.1;
2 : native debug using gdb-7.0.1, which was built for and running
under mipsel-linux;

gdb always complains about "Cannot access memory at address 0x32a14"

Maybe I've missed something important when following instruction at
http://sources.redhat.com/glibc/wiki/Debugging/Loader_Debugging

Thanks again.

-- 
Best Regards.


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

* Re: cross debug glibc loader problem
  2010-02-11  3:12   ` Amker.Cheng
@ 2010-02-11 20:59     ` Matt Rice
  2010-02-11 22:02       ` Jan Kratochvil
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Rice @ 2010-02-11 20:59 UTC (permalink / raw)
  To: Amker.Cheng; +Cc: gdb

On Wed, Feb 10, 2010 at 7:12 PM, Amker.Cheng <amker.cheng@gmail.com> wrote:
> On Thu, Feb 11, 2010 at 3:45 AM, Matt Rice <ratmice@gmail.com> wrote:
>> On Wed, Feb 10, 2010 at 4:09 AM, Amker.Cheng <amker.cheng@gmail.com> wrote:
>
>>
>> I would try it out with gdb from cvs, and if that doesn't work
>> investigate Jan Kratochvil's recent PIE: series of threads on the
>> gdb-patches list (at least some of which have been integrated), as I
>> am lead to believe from the first thread in the series that those
>> patches covered debugging ld.so.
>>
> Thanks, but I trid gdb-7.0.1 in two ways, both facing the same problem:

Yeah, I don't think 7.0.1 is recent enough to contain Jan's patches
gdb seems to be moving at quite the pace these days

> 1 : cross debug using gdb-7.0.1;
> 2 : native debug using gdb-7.0.1, which was built for and running
> under mipsel-linux;
>
> gdb always complains about "Cannot access memory at address 0x32a14"
>
> Maybe I've missed something important when following instruction at
> http://sources.redhat.com/glibc/wiki/Debugging/Loader_Debugging

I tried the same on x86_64 a while back, and had the same issues I
spoke with the author of this documentation, he couldn't remember the
version of gdb used and said that he had possibly patched it,

I believe that with a properly working gdb capable of debugging ld.so
this documentation is sound and will prove helpful to you.

but to get gdb capable of debugging ld.so, you'll currently have to
try out cvs, and if that doesn't work, researching Jan's PIE patches
is your best bet.

as in the first mail in the thread he mentions the various cases of
ld.so debugging.

http://sourceware.org/ml/gdb-patches/2009-11/msg00167.html
(note that these threads are split across months which if i recall the
list archives handle less than gracefully)

sorry i'm being real vague here, but this is a large patch series
which has undergone recent progress, and i'm not really aware of the
current status.   But in these cases the best way to ensure that a
future gdb release works how you need it is to try out current
developments.


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

* Re: cross debug glibc loader problem
  2010-02-11 20:59     ` Matt Rice
@ 2010-02-11 22:02       ` Jan Kratochvil
  2010-02-21  9:48         ` Amker.Cheng
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2010-02-11 22:02 UTC (permalink / raw)
  To: Matt Rice; +Cc: Amker.Cheng, gdb

On Thu, 11 Feb 2010 21:59:26 +0100, Matt Rice wrote:
> > Maybe I've missed something important when following instruction at
> > http://sources.redhat.com/glibc/wiki/Debugging/Loader_Debugging

These instructions were written before the PIE patch so they should work even
with older version GDB.  Still I do not have experience with this part.
The errors like
	"Cannot access memory at address 0x32a14"
for debugging glibc-related stuff got fixed by the PIE patch for me (x86*).


> and i'm not really aware of the current status.

The basic functionality is in FSF GDB HEAD now, maybe you can add just:
	[patch] Fix PIE for 64bit gdb -> 32bit inferior
	http://sourceware.org/ml/gdb-patches/2010-02/msg00289.html
(unaware of your MIPS setup)


Thanks,
Jan


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

* Re: cross debug glibc loader problem
  2010-02-11 22:02       ` Jan Kratochvil
@ 2010-02-21  9:48         ` Amker.Cheng
  0 siblings, 0 replies; 6+ messages in thread
From: Amker.Cheng @ 2010-02-21  9:48 UTC (permalink / raw)
  To: gdb; +Cc: Matt Rice, Jan Kratochvil

I was on holiday last few days and sorry for this overdue reply.
Again Thank all of you guys for detailed explanation, I tried
the head version and it works(mips target).


-- 
Best Regards.


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

end of thread, other threads:[~2010-02-21  9:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-10 12:09 cross debug glibc loader problem Amker.Cheng
2010-02-10 19:45 ` Matt Rice
2010-02-11  3:12   ` Amker.Cheng
2010-02-11 20:59     ` Matt Rice
2010-02-11 22:02       ` Jan Kratochvil
2010-02-21  9:48         ` Amker.Cheng

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