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



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: []
0x00000001 (NEEDED)                     Shared library: []
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/'
checking sub-depends for '/lib/'
checking sub-depends for 'not found'
checking sub-depends for '/lib/' => /lib/ (0x00000000) => not found (0x00000000) => /lib/ (0x00000000)
    /lib/ => /lib/ (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, although the softlink of that name to the library does exist under the solib-absolute-prefix/lib directory.  Under ldd, why is 'not found' reported for this lib instead of /lib/ 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.