AnsweredAssumed Answered

gdb - Unable to load the executable's loadmap

Question asked by mhammons on Nov 15, 2011
Latest reply on Nov 15, 2011 by jiez

Hi,

 

Hope this is the right forum.

I'm having an issue with the debugger (gdb) and executable's loadmap.  I have it down to a very simple example and was looking for some assistence.

 

I take a simple program:

 

#include <stdio.h>


int main() {

   printf("Hello world!\n");

}

 

compile it:

 

bfin-linux-uclibc-gcc -g -o a a.c

 

readelf it:

 

mhammons@devmach:$ bfin-linux-uclibc-readelf -d a

 

Dynamic section at offset 0x748 contains 20 entries:
  Tag        Type                         Name/Value
0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED)                     Shared library: [libc.so.0]
0x0000000c (INIT)                       0x39c
0x0000000d (FINI)                       0x6ec
0x00000004 (HASH)                       0x108
0x00000005 (STRTAB)                     0x248
0x00000006 (SYMTAB)                     0x158
0x0000000a (STRSZ)                      211 (bytes)
0x0000000b (SYMENT)                     16 (bytes)
0x00000003 (PLTGOT)                     0x1828
0x00000002 (PLTRELSZ)                   16 (bytes)
0x00000014 (PLTREL)                     REL
0x00000017 (JMPREL)                     0x38c
0x00000011 (REL)                        0x35c
0x00000012 (RELSZ)                      64 (bytes)
0x00000013 (RELENT)                     8 (bytes)
0x6ffffffe (VERNEED)                    0x33c
0x6fffffff (VERNEEDNUM)                 1
0x6ffffff0 (VERSYM)                     0x31c
0x00000000 (NULL)                       0x0

 

ldd it:

 

mhammons@devmach:$ bfin-linux-uclibc-ldd a
ldd: can't map cache '/etc/ld.so.cache'
checking sub-depends for '/lib/libgcc_s.so.1'
checking sub-depends for 'not found'
checking sub-depends for '/lib/libc.so.6'
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00000000)
    libc.so.0 => not found (0x00000000)
    libc.so.6 => /lib/libc.so.6 (0x00000000)
    /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)

 

Load it into gdb:

 

mhammons@devmach:$ bfin-linux-uclibc-gdb a
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=bfin-linux-uclibc"...
(gdb) show solib-absolute-prefix
Prefix for loading absolute shared library symbol files is "/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime".

 

Things look ok.  However I cannot get information on the shared libs, e.g.

 

(gdb) info shared
Unable to load the executable's loadmap.

 

With a more complex program where the executable is running on the target and gdbserver is attached to it, I have the same issue.  When loading the exec on the host and attaching remotely the executable's loadmap fails to load.   I have read that generally this is due to the solib paths not being set up properly, however in the simple example above I am fairly confident that the path is correct.

 

I had a couple of questions:

1) is there something obvious that I have missed?

2) I noticed that the ldd output reports not found for libc.so.0, although the softlink of that name to the libuClibc-0.9.29.so library does exist under the solib-absolute-prefix/lib directory.  Under ldd, why is 'not found' reported for this lib instead of /lib/libc.so.0? Is that normal?

3) There are a couple of host libs that appear in the ldd output as well... is that normal?  They do not appear in the readelf output so I question whether the are merely an artifact of ldd, rather than present in the elf.

 

I'd love to get the debugger functional, particularly remotely, but this is my current blocking issue.

 

Thanks for any info.

Regards,
Marc


Outcomes