[uClibc] gdbserver on arm?

Joakim Tjernlund Joakim.Tjernlund at lumentis.se
Thu Nov 18 22:41:52 UTC 2004


>   Hey, have something here that seems to me as if I'm missing something 
> obvious, but am just not getting it.  So far I've been unable to get a 
> gdbserver session going properly on an ARM-based chip (ARM922T core), 
> when connected from the matching arm-linux-uclibc-gdb - both buildroot 
> created.
> 
>   After pulling the buildroot (both and older one and the latest one for 
> sanity) and doing a simple build with both target gdb and gdbserver, I 
> can boot off the generated image.  I can launch gdb on the target with a 
> small test executable and it works beautifully.  It indicates that it's 
> loading the threading library, so am assuming that thread support is 
> happy as well (this is good - I'll need it later..)  The problem comes 
> in when I try to debug an application that is just too big for gdb and 
> the app at the same time on the target: A perfect opportunity for 
> gdbserver, right?
> 
>   I have a test program that is a simple loop, something to just step 
> through as it prints numbers.  So a standard invocation of gdbserver on 
> the target:
> 
> gdbserver host:1234 test
> Process test created; pid = 142
> 
>   On the PC:
> 
> arm-linux-uclibc-gdb test
> 
> GNU gdb 6.2.1
> Copyright 2004 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=i386-pc-linux-gnu 
> --target=arm-linux-uclibc"...
> (gdb) target remote 192.168.192.214:1234
> Remote debugging using 192.168.192.214:1234
> 0x4000106c in ?? ()
> warning: Unable to find dynamic linker breakpoint function.
> GDB will be unable to debug shared library initializers
> and track explicitly loaded dynamic code.
> (gdb) break main
> Breakpoint 1 at 0x8494: file test.c, line 5.
> (gdb) cont
> Continuing.
> Error while mapping shared library sections:
> /lib/libc.so.0: No such file or directory.
> Error while mapping shared library sections:
> /lib/ld-uClibc.so.0: No such file or directory.
> Error while reading shared library symbols:
> /lib/libc.so.0: No such file or directory.
> Error while reading shared library symbols:
> /lib/ld-uClibc.so.0: No such file or directory.
> 
> (gdb) load [fully qualified path]/lib/libc.so.0
> Loading section .hash, size 0x25ac lma 0xd4
> Memory access error while loading section .hash.
> 
> Breakpoint 1, main (argc=1, argv=0xbffffed4) at test.c:5
> 5         int n = 0;
> (gdb) print n
> $1 = 1
> (gdb) step
> Cannot access memory at address 0x0
> 7         for(n = 0; n < 10; n++) {
> (gdb)
> Cannot access memory at address 0x0
> 8           printf("%d\n", n);
> (gdb)
> Segmentation fault
> 
> 
> OK, so there are a few things here:
> 1) Couldn't load dynamic linker?
> 2) Couldn't find libraries to load?

Possibly GDB is looking for your target libs at the same place in the host and
that won't work unless you put them there.

> 3) Couldn't load libraries given a full path?

hmm, is "load" the right command for this? I would try add-symbol something, as
load may actally try to load the whole lib instead of just the symbols. 

> 4) The most obvious: dies trying to step through code.
> 
> Am at a loss, and could really use the tools.  Google for gdbserver and 
> uClibc doesn't yield much, neither do the gdb errors google out to 
> anything useful (so far, am still looking..)
> 
> Advice?
> 
> 
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://uclibc.org/mailman/listinfo/uclibc



More information about the uClibc mailing list