gdbserver远程调试嵌入式开发板
安装环境
rlxbuild.mk
CONFIG_APP_GDBSERVER
grep -rn CONFIG_USER_GDB_GDBSERVER
./gdbserver 192.168.0.99:2345 helloGDB
mips-linux-gdb helloGDB
mips-linux-gdbtui helloGDB
gdb helloGDB
sudo apt-get install libx11-6:i386
sudo apt-get install lib32ncurses5
sudo apt-get install libexpat-dev:i386
sudo ln -s /lib/i386-linux-gnu/libexpat.so.1 /lib/i386-linux-gnu/libexpat.so.0
locate libncurses.so.5
target remote 192.168.0.1:2345
tftp 192.168.3.11 -g -l dnsmasq -r dnsmasq
./gdbserver 192.168.3.11:2345 dnsmasq
target remote 192.168.3.1:2345
mips-linux-gdb hello
tftp 192.168.3.11 -g -l mips-linux-gdb -r mips-linux-gdb
./gdbserver 192.168.3.11:2345 hello
1.ubuntu编译带debug信息的执行文件
root@ubuntu:/# mips-linux-gcc -W -g hello.c -o hello -lm
2.load调试文件进入开发板子,开启调试
#ONT/system/shell>tftp -g 192.168.3.11 -l gdbserver -r gdbserver
#ONT/system/shell>tftp -g 192.168.3.11 -l hello -r hello
#ONT/system/shell>chmod +x hello
#ONT/system/shell>./gdbserver 192.168.3.11:2345 hello
3.ubuntu连接目标版调试
root@ubuntu:/# mips-linux-gdbtui hello
(gdb) target remote 192.168.3.1:2345
Remote debugging using 192.168.3.1:2345
[New Thread 657]
0x2aaa8a40 in _start () from /opt/apollo/rsdk-1.5.6-5281-EB-2.6.30-0.9.30.3-110915/bin/…/lib/ld-uClibc.so.0
(gdb) list
(gdb) b 66
(gdb) c
#ONT/system/shell>./gdbserver 192.168.0.130:2345 dnsmasq -K -5 -6 /bin/mReport -C /tmp/dnsmasq.cfg -d
(gdb) b dnsmasq.c:108
Breakpoint 1 at 0x417598: file dnsmasq.c, line 108.
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y 0x00417598 in main at dnsmasq.c:108
(gdb) set args -K -5 -6 /bin/mReport -C /tmp/dnsmasq.cfg
(gdb) show args
Argument list to give program being debugged when it is started is “-K -5 -6 /bin/mReport -C /tmp/dnsmasq.cfg”.
(gdb)