Debugging an embedded application with gdbserver

Thread Starter

Robert Murch

Joined Nov 2, 2015
43
I am attempting to debug an embedded Linux application with gdbserver. The process:

I open up a command prompt: ssh into the target, and start gdbserver:

Code:
rob@linux038:~$ ssh -p 2222 root@10.12.1.81
root@10.12.1.81's password:
# cd /usr/local/name/bin
# gdbserver host:1000 lonepeak -qws
Process lonepeak created; pid = 1706
Listening on port 1000
Remote debugging from host 10.12.1.77
I then open a different terminal @ lonepeak directory and start gdb:

Code:
rob@linux038:~/sandbox//LonePeak$ gdb lonepeak
GNU gdb (Ubuntu 8.2-0ubuntu1~16.04.1) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
  <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from lonepeak...done.
warning: File "/home/rob/sandbox/LonePeak/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
   add-auto-load-safe-path /home/rob/sandbox/LonePeak/.gdbinit
line to your configuration file "/home/rob/.gdbinit".
To completely disable this security protection add
   set auto-load safe-path /
line to your configuration file "/home/rob/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
   info "(gdb)Auto-loading safe path"
(gdb) target remote 10.12.1.81:1000
Remote debugging using 10.12.1.81:1000
Reading /lib/ld-linux.so.3 from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
warning: `target:/lib/ld-linux.so.3': Shared library architecture unknown is not compatible with target architecture i386.
Reading /lib/ld-linux.so.3 from remote target...
warning: `target:/lib/ld-linux.so.3': Shared library architecture unknown is not compatible with target architecture i386.
Reading symbols from target:/lib/ld-linux.so.3...(no debugging symbols found)...done.
0x00000000 in ?? ()
So I am fairly new to linux. When I build the project I simply:

make DEVICE=P51 -j4

and I am assuming it builds with debugging symbols enabled. I could be wrong, how might I find out?
 

turboscrew

Joined Dec 7, 2018
16
"This GDB was configured as "x86_64-linux-gnu"."
"warning: `target:/lib/ld-linux.so.3': Shared library architecture unknown is not compatible with target architecture i386."
It looks like you are using a wrong GDB. Which architecture are you debugging?
You need a cross-gdb or gdb-multiarch.
Or have you just mixed 32-bit and 64-bit stuff?
 
Top