This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Single stepping inside shared lib functions on ARM


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
-- 




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]