Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Help with stepping into shared-library with stripped ld-linux on arm board
@ 2007-03-22 15:29 Xu Haojun-a18535
  2007-03-22 15:45 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Xu Haojun-a18535 @ 2007-03-22 15:29 UTC (permalink / raw)
  To: gdb

Hello, gdb experts.

Recently we are trying to stepping into shared-library on arm board
using GDB 6.3 with gdbserver

First we find ld-linux.so is stripped so that gdb cannot insert a
breakpoint at _dl_debug_state. Then it has to continue with SINGLE_STEP
out of the linker codes, which is quite slow!!
Then one option we used is to re-compile the glibc with symbol info and
put it into arm board, then it works.

But that's not final one, because eventually all the libs and exes in
arm board have to be pre-linked for performance, so we have to figure
out ways to debug shared-library with a stripped & pre-linked ld-linux.
What we did is modify the enable_break() in solib-srv4.c and return a
hard-coded address for _dl_debug_state, since it is pre-linked and the
address is known.
But it turns out not work, and it looks gdb still has to continue with
SINGLE_STEP out of the linker codes. I checked the gdbserver using
strace, it looks the breakpoint in LD is inserted using PTRACE_POKETEXT
in the correct address, don't know why it not work.

Any clue about this? What makes gdb decide to send SINGLE_STEP or CONT
to gdbserver during stepping into a shared library? It looks it keep
sending SINGLE_STEP command to gdbserver, till out of linker code. Do I
miss something besides enable_break() in solib-srv4.c?

Your help is greatly appreciated!


Best Regards
Haojun 


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

* Re: Help with stepping into shared-library with stripped ld-linux  on arm board
  2007-03-22 15:29 Help with stepping into shared-library with stripped ld-linux on arm board Xu Haojun-a18535
@ 2007-03-22 15:45 ` Daniel Jacobowitz
       [not found]   ` <1174588974.9964.9.camel@localhost.localdomain>
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-03-22 15:45 UTC (permalink / raw)
  To: Xu Haojun-a18535; +Cc: gdb

On Thu, Mar 22, 2007 at 11:29:14PM +0800, Xu Haojun-a18535 wrote:
> Hello, gdb experts.
> 
> Recently we are trying to stepping into shared-library on arm board
> using GDB 6.3 with gdbserver
> 
> First we find ld-linux.so is stripped so that gdb cannot insert a
> breakpoint at _dl_debug_state. Then it has to continue with SINGLE_STEP
> out of the linker codes, which is quite slow!!
> Then one option we used is to re-compile the glibc with symbol info and
> put it into arm board, then it works.

I suggest you have two copies of your root filesystem.  Point GDB at
one on your host that is not stripped, and run one that is exactly the
same but stripped on the target.  Then everything will work much
better.

> Any clue about this? What makes gdb decide to send SINGLE_STEP or CONT
> to gdbserver during stepping into a shared library? It looks it keep
> sending SINGLE_STEP command to gdbserver, till out of linker code. Do I
> miss something besides enable_break() in solib-srv4.c?

It needs to know what function it's in to recognize shared library
trampolines.  Without symbols, it's not going to work.

A compromise which might help is to use strip -g for ld.so and
libpthread.so on your target instead of strip; that will leave the
symbol tables, and remove only the debug info.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Help with stepping into shared-library with stripped  ld-linuxon arm board
       [not found]     ` <6D989D7EEBF1A34EA5CAF6A24FD3E15801E3D06D@zmy16exm63.ds.mot.com>
@ 2007-03-23 11:55       ` Daniel Jacobowitz
  2007-03-23 13:12         ` Help with stepping into shared-library with strippedld-linuxon " Xu Haojun-a18535
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-03-23 11:55 UTC (permalink / raw)
  To: Xu Haojun-a18535; +Cc: Michael Snyder, gdb, Xie ShaoHua-A22496

On Fri, Mar 23, 2007 at 06:56:55PM +0800, Xu Haojun-a18535 wrote:
> But this try seems not work, it still takes a long time when
> stepping into shared-library, we are really confused where goes wrong,
> it there any other place which controls the shared-library stepping
> behavior besides enable_break() in solib-srv4.c ?

You've already asked this question and I've already answered it.
There are a lot of things that will go wrong without symbols.

I suspect this one is related to "fixup".


-- 
Daniel Jacobowitz
CodeSourcery


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

* RE: Help with stepping into shared-library with strippedld-linuxon arm board
  2007-03-23 11:55       ` Help with stepping into shared-library with stripped ld-linuxon " Daniel Jacobowitz
@ 2007-03-23 13:12         ` Xu Haojun-a18535
  2007-03-23 13:16           ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Xu Haojun-a18535 @ 2007-03-23 13:12 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Michael Snyder, gdb, Xie ShaoHua-A22496

Daniel,

I know your solution and it works really.

But actually we are trying to figure out ways to debug an arm board with ld-linux.so stripped of all symbols. 
"There are a lot of things that will go wrong without symbols." That's exactly what we want to make clear - how the symbols of ld-linux.so is used in gdb and where will go wrong without these symbols.
So that we can figure out ways to serve our special reqs. 
Any clue about this?

Best Regards
Haojun

> -----Original Message-----
> From: Daniel Jacobowitz [mailto:drow@false.org]
> Sent: 2007年3月23日 19:55
> To: Xu Haojun-a18535
> Cc: Michael Snyder; gdb@sourceware.org; Xie ShaoHua-A22496
> Subject: Re: Help with stepping into shared-library with strippedld-linuxon arm
> board
> 
> On Fri, Mar 23, 2007 at 06:56:55PM +0800, Xu Haojun-a18535 wrote:
> > But this try seems not work, it still takes a long time when
> > stepping into shared-library, we are really confused where goes wrong,
> > it there any other place which controls the shared-library stepping
> > behavior besides enable_break() in solib-srv4.c ?
> 
> You've already asked this question and I've already answered it.
> There are a lot of things that will go wrong without symbols.
> 
> I suspect this one is related to "fixup".
> 
> 
> --
> Daniel Jacobowitz
> CodeSourcery


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

* Re: Help with stepping into shared-library with strippedld-linuxon  arm board
  2007-03-23 13:12         ` Help with stepping into shared-library with strippedld-linuxon " Xu Haojun-a18535
@ 2007-03-23 13:16           ` Daniel Jacobowitz
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-03-23 13:16 UTC (permalink / raw)
  To: Xu Haojun-a18535; +Cc: Michael Snyder, gdb, Xie ShaoHua-A22496

On Fri, Mar 23, 2007 at 09:10:56PM +0800, Xu Haojun-a18535 wrote:
> Daniel,
> 
> I know your solution and it works really.
> 
> But actually we are trying to figure out ways to debug an arm board with ld-linux.so stripped of all symbols. 
> "There are a lot of things that will go wrong without symbols." That's exactly what we want to make clear - how the symbols of ld-linux.so is used in gdb and where will go wrong without these symbols.
> So that we can figure out ways to serve our special reqs. 
> Any clue about this?

No.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2007-03-23 13:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-22 15:29 Help with stepping into shared-library with stripped ld-linux on arm board Xu Haojun-a18535
2007-03-22 15:45 ` Daniel Jacobowitz
     [not found]   ` <1174588974.9964.9.camel@localhost.localdomain>
     [not found]     ` <6D989D7EEBF1A34EA5CAF6A24FD3E15801E3D06D@zmy16exm63.ds.mot.com>
2007-03-23 11:55       ` Help with stepping into shared-library with stripped ld-linuxon " Daniel Jacobowitz
2007-03-23 13:12         ` Help with stepping into shared-library with strippedld-linuxon " Xu Haojun-a18535
2007-03-23 13:16           ` Daniel Jacobowitz

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