Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Single stepping inside shared lib functions on ARM
@ 2007-01-24 11:04 Dheeraj V.S.
  2007-01-24 12:12 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Dheeraj V.S. @ 2007-01-24 11:04 UTC (permalink / raw)
  To: gdb

I'm remote debugging on an ARM target using gdb 6.5.
I'm unable to step into functions that are defined inside shared libraries
although the identical .so file is accessible both by the host and target.

These are the test programs used (both compiled using gcc version 3.4.4 with
-g option):

linux:/home/dheeraj # cat gdb_test.c
#include <stdio.h>

void function ()
{
  printf ("In function\n");
}

extern void function_in_lib();

int main ()
{
  printf ("In main\n");
  function();
  function_in_lib();
  printf ("Quitting\n");
  return 0;
}

linux:/home/dheeraj # cat gdb_test_lib.c
#include <stdio.h>
void function_in_lib ()
{
  printf ("In function_in_lib\n");
}

The following is the output of gdb 6.5:
Note the lines with the arrows (<----)

linux:/home/dheeraj # arm-unknown-linux-gnu-gdb
GNU gdb 6.5
This GDB was configured as "--host=i686-pc-linux-gnu
--target=arm-unknown-linux-gnu".
(gdb) set solib-absolute-prefix  /home/dheeraj
(gdb) set solib-search-path /home/dheeraj
(gdb) file gdb_test
Reading symbols from /home/dheeraj/gdb_test...done.
(gdb) b main
Breakpoint 1 at 0x8630: file gdb_test.c, line 12.
(gdb) target remote 10.18.21.35:3456
Remote debugging using 10.18.21.35:3456
0x40000ba0 in ?? ()
(gdb) c
Continuing.

Breakpoint 1, main () at gdb_test.c:12
12        printf ("In main\n");
(gdb) n
Cannot access memory at address 0x0  <---- Problem??
13        function();
(gdb) s
function () at gdb_test.c:5  <---- Stepping inside the same file is OK.
5         printf ("In function\n");
(gdb) n
6       }
(gdb) n
Cannot access memory at address 0x0
main () at gdb_test.c:14
14        function_in_lib();
(gdb) s
0x40015060 in ?? ()  <---- Cannot step into a function in shared lib!
(gdb) n
Cannot find bounds of current function  <---- Problem??
(gdb) c
Continuing.

I tried the same using gdb 5.3. This time, I don't get the errors like
"Cannot access memory at address 0x0" and "Cannot find bounds of current
function", but I'm still unable to step into the shared lib function. In gdb
5.3, the "step" command is treated as a "next" command for the shared lib
function.

Similar problems were reported in some list archives, but I've not found a
solution that works.
Any help is appreciated.

Dheeraj
-- 




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

* Re: Single stepping inside shared lib functions on ARM
  2007-01-24 11:04 Single stepping inside shared lib functions on ARM Dheeraj V.S.
@ 2007-01-24 12:12 ` Daniel Jacobowitz
  2007-01-24 12:56   ` Dheeraj V.S.
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-01-24 12:12 UTC (permalink / raw)
  To: Dheeraj V.S.; +Cc: gdb

On Wed, Jan 24, 2007 at 04:33:15PM +0530, Dheeraj V.S. wrote:
> (gdb) set solib-absolute-prefix  /home/dheeraj
> (gdb) set solib-search-path /home/dheeraj

Where are your libraries on the host system?  What does "info shared"
say when you are stopped at main?

-- 
Daniel Jacobowitz
CodeSourcery


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

* RE: Single stepping inside shared lib functions on ARM
  2007-01-24 12:12 ` Daniel Jacobowitz
@ 2007-01-24 12:56   ` Dheeraj V.S.
  2007-01-24 13:07     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Dheeraj V.S. @ 2007-01-24 12:56 UTC (permalink / raw)
  To: gdb

On Wed, Jan 24, 2007 17:42, Daniel Jacobowitz wrote:
> On Wed, Jan 24, 2007 at 04:33:15PM +0530, Dheeraj V.S. wrote:
> > (gdb) set solib-absolute-prefix  /home/dheeraj
> > (gdb) set solib-search-path /home/dheeraj
> 
> Where are your libraries on the host system?
The library is at /home/dheeraj/
This directory is mounted on the target. The same directory is used on the
host too.

> What does "info shared" say when you are stopped at main?
 (gdb) info share
warning: .dynamic section for "/usr/arm/sysroot/lib/libc.so.6" is not at the
expected address
warning: .dynamic section for "/usr/arm/sysroot/lib/ld-linux.so.2" is not at
the expected address
From        To          Syms Read   Shared Object Library
0x400224b4  0x40022630  No          /home/dheeraj/libgdb_test.so.1
0x40041910  0x40118758  No          /usr/arm/sysroot/lib/libc.so.6
0x40000b80  0x40012bc8  No          /usr/arm/sysroot/lib/ld-linux.so.2


Dheeraj
-- 




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

* Re: Single stepping inside shared lib functions on ARM
  2007-01-24 12:56   ` Dheeraj V.S.
@ 2007-01-24 13:07     ` Daniel Jacobowitz
  2007-01-24 15:59       ` Dheeraj V.S.
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-01-24 13:07 UTC (permalink / raw)
  To: Dheeraj V.S.; +Cc: gdb

On Wed, Jan 24, 2007 at 06:16:42PM +0530, Dheeraj V.S. wrote:
> On Wed, Jan 24, 2007 17:42, Daniel Jacobowitz wrote:
> > On Wed, Jan 24, 2007 at 04:33:15PM +0530, Dheeraj V.S. wrote:
> > > (gdb) set solib-absolute-prefix  /home/dheeraj
> > > (gdb) set solib-search-path /home/dheeraj
> > 
> > Where are your libraries on the host system?
> The library is at /home/dheeraj/
> This directory is mounted on the target. The same directory is used on the
> host too.

I asked where all your libraries were, not just the test one.  If they
are using the same paths on your host and target, don't set
solib-absolute-prefix to anything.

> > What does "info shared" say when you are stopped at main?
>  (gdb) info share
> warning: .dynamic section for "/usr/arm/sysroot/lib/libc.so.6" is not at the
> expected address
> warning: .dynamic section for "/usr/arm/sysroot/lib/ld-linux.so.2" is not at
> the expected address
> From        To          Syms Read   Shared Object Library
> 0x400224b4  0x40022630  No          /home/dheeraj/libgdb_test.so.1
> 0x40041910  0x40118758  No          /usr/arm/sysroot/lib/libc.so.6
> 0x40000b80  0x40012bc8  No          /usr/arm/sysroot/lib/ld-linux.so.2

With solib-absolute-prefix set, GDB will search for
"/usr/arm/sysroot/lib/libc.so.6" at
"/home/dheeraj/usr/arm/sysroot/lib/libc.so.6".  If that's not what you
want, you probably shouldn't set it.

Also, that warning means that the libraries GDB found on your host are
not the same versions as the ones on your target.  They have to be the
same versions, or it can not step into them.

-- 
Daniel Jacobowitz
CodeSourcery


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

* RE: Single stepping inside shared lib functions on ARM
  2007-01-24 13:07     ` Daniel Jacobowitz
@ 2007-01-24 15:59       ` Dheeraj V.S.
  0 siblings, 0 replies; 5+ messages in thread
From: Dheeraj V.S. @ 2007-01-24 15:59 UTC (permalink / raw)
  To: gdb

On Wed, Jan 24, 2007 18:38, Daniel Jacobowitz wrote:
> On Wed, Jan 24, 2007 at 06:16:42PM +0530, Dheeraj V.S. wrote:
> > From        To          Syms Read   Shared Object Library
> > 0x400224b4  0x40022630  No          /home/dheeraj/libgdb_test.so.1
> > 0x40041910  0x40118758  No          /usr/arm/sysroot/lib/libc.so.6
> > 0x40000b80  0x40012bc8  No          /usr/arm/sysroot/lib/ld-
> linux.so.2
> 
> Also, that warning means that the libraries GDB found on your host are
> not the same versions as the ones on your target.  They have to be the
> same versions, or it can not step into them.

You're right. The versions of libc.so and ld-linux.so were not the same on
the host. That's the reason why we see "No" under the "Syms Read" column of
"info share".

By correctly setting the solib-absolute-prefix, the problem is resolved.

Thank you.
Dheeraj
-- 




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

end of thread, other threads:[~2007-01-24 15:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-24 11:04 Single stepping inside shared lib functions on ARM Dheeraj V.S.
2007-01-24 12:12 ` Daniel Jacobowitz
2007-01-24 12:56   ` Dheeraj V.S.
2007-01-24 13:07     ` Daniel Jacobowitz
2007-01-24 15:59       ` Dheeraj V.S.

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