gdbserver is the main tool for embedded development and debugging, which depends on the development board's gdbserver programs and the cross compiler tool chain in the mips-linux-gnu-gdb command. gdbserver can work properly if PC and board share the same network.
this only describes gdbserver's startup and connection methods,related commands follow the standard gdbserver's commands,check the internet for more details.
gdb and gdbserver command position:
bin/mips-linux-gnu-gdbmips-linux-gnu/libc/usr/lib/bin/gdbservermips-linux-gnu/libc/uclibc/usr/lib/bin/gdbserver$ mips-linux-gnu-gdb [PC's application path]
example:
$ mips-linux-gnu-gdb sample-Encoder-h264(Application path)
GNU gdb (GDB) 7.6.2
Copyright (C) 2013 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 "--host=x86_64-unknown-linux-gnu --target=mips-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/ykli/work/rvms/development/sdk/release/samples/api-samples/sample-Encoder-h264...done.
Notes:
(no debugging symbols found),it might mean that the application is already stripped (PC),and the debug segment is deleted so gdb can not debug it.Applications usually use dynamic link libraries such as: libc,ld, ... when break is running in a dynamic library(for example:memcpy)it is often unable to track the location of the current PC. It is because the load address of the dynamic library is not fixed. so it is needed to specify the dynamic library loading path.
method:
set solib-search-path /opt/mips-gcc472-glibc216-64bit/mips-linux-gnu/libc/lib/:/opt/mips-gcc472-glibc216-64bit/mips-linux-gnu/lib
Use ":" for multiple paths. Notes: In the above example, only specify the toolchain's glibc from the libc series library and libstdc++,... as major external libraries.
mips-linux-gnu/libc/lib与mips-linux-gnu/libmips-linux-gnu/libc/uclibc/lib与mips-linux-gnu/lib/uclibcgdbserver [PC's IP:Port,same Port as the second step] [application path]
example:
gdbserver 192.168.1.100:1234 /tmp/sample-Encoder-h264
target remote [Board's IP:Port]
example:
target remote 192.168.1.101:1234
PC will display such informations:
(gdb) target remote 192.168.1.101:1234
Remote debugging using 192.168.1.101:1234
Reading symbols from /opt/mips-gcc472-glibc216-64bit/mips-linux-gnu/libc/lib/ld.so.1...done.
Loaded symbols for /opt/mips-gcc472-glibc216-64bit/mips-linux-gnu/libc/lib/ld.so.1
0x77fc7070 in __start () from /opt/mips-gcc472-glibc216-64bit/mips-linux-gnu/libc/lib/ld.so.1
At this point, you can run the gdb command on the host.
Notes: gdbserver and local gdb are different, starts a procedure with "c" command(continue).