rtl-9300开发板集成gdbserver,虚拟机gdb远程调试

rtl-9300开发板集成gdbserver,虚拟机gdb远程调试,第1张

rtl-9300开发板集成gdbserver,虚拟机gdb远程调试

RTL 9300开发板:
RTL9300# # upgrade runtimeforce vmlinux.bix

RTK.0> port set port all state enable
RTK.0> vlan set vlan-table vid 1 member 22,28 //22:面板端口; 28:连接cpu端口
RTK.0> exit

ifconfig eth0 192.168.122.32 up //配置虚拟机与开发板属于同一个网段,能ping通 ping 192.168.122.130

PING 192.168.122.130 (192.168.122.130): 56 data bytes
64 bytes from 192.168.122.130: icmp_seq=0 ttl=64 time=0.0 ms

gdbserver 192.168.122.32:9999 /bin/diag //192.168.122.32 ,开发板网卡ip地址, 9999:未被占用的端口号。

Process /bin/diag created; pid = 76
Listening on port 9999
Remote debugging from host 192.168.122.130
readchar: Got EOF
Remote side has terminated connection. GDBserver will reopen the connection.
Listening on port 9999
Remote debugging from host 192.168.122.130
RTK.0>
RTK.0>
RTK.0> vlan set pvid inner port all 1
RTK.0> vlan set pvid inner port all
UINT:pvid - pvid

RTK.0> vlan set pvid inner port all 1

RTK.0> vlan set pvid inner port all 1
RTK.0>
RTK.0>
RTK.0>
RTK.0> vlan set pvid inner port
- port list (e.g. 3 or 6-8)
all - all ports

RTK.0> vlan set pvid inner port 24 1

虚拟机:
root@ubuntu:~/gdb-tool/libgdb/bin# mips-linux-uclibc-strip gdbserver -o gdbaa //去掉符号表,压缩大小
root@ubuntu:~/gdb-tool/libgdb/bin# rm -rf gdbserver
root@ubuntu:~/gdb-tool/libgdb/bin# mv gdbaa gdbserver
root@ubuntu:~/gdb-tool/libgdb/bin# cp gdbserver /root/rtk-9310/kernel/uClinux/romfs/bin/ -rf -a
root@ubuntu:~/rtk-9310# make

PC:
//Note:可以将tftp安装在虚拟机上,设置tftp目录,在开发板上直接下载;无需通过中间媒介PC
rm -rf vmlinux.bix && scp 192.168.122.130:/root/rtk-9310/image/vmlinux.bix ./

虚拟机:
//Note:/opt/rtk-ms-2.0.0-linux-mips-3.18-4.8.5-u0.9.33-toolchain/bin/mips-linux-uclibc-gdb, 与gdb用同样的交叉编译工具链

root@ubuntu:~/rtk-9310/kernel/uClinux/romfs/bin# /opt/rtk-ms-2.0.0-linux-mips-3.18-4.8.5-u0.9.33-toolchain/bin/mips-linux-uclibc-gdb ./diag
root@ubuntu:~/rtk-9310/kernel/uClinux/romfs/bin# /opt/rtk-ms-2.0.0-linux-mips-3.18-4.8.5-u0.9.33-toolchain/bin/mips-linux-uclibc-gdb ./diag
GNU gdb (Realtek MSDK-4.8.5p1 Build 2536) 7.8.2
Copyright © 2014 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=i686-pc-linux --target=mips-linux-uclibc”.
Type “show configuration” for configuration details.
For bug reporting instructions, please see:
http://bugs.linaro.org.
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 ./diag…(no debugging symbols found)…done.
(gdb) target remote 192.168.122.32:9999
Remote debugging using 192.168.122.32:9999 //Note:连接gdbserver成功打印
Reading symbols from /opt/rtk-ms-2.0.0-linux-mips-3.18-4.8.5-u0.9.33-toolchain/bin/…/lib/ld-uClibc.so.0…(no debugging symbols found)…done. //编译app时加上-g,别strip掉
Loaded symbols for /opt/rtk-ms-2.0.0-linux-mips-3.18-4.8.5-u0.9.33-toolchain/bin/…/lib/ld-uClibc.so.0
0x77e74f50 in _ftext () from /opt/rtk-ms-2.0.0-linux-mips-3.18-4.8.5-u0.9.33-toolchain/bin/…/lib/ld-uClibc.so.0
(gdb) b cparser_cmd_vlan_set_pvid_inner_port_ports_all_pvid
Breakpoint 1 at 0x4ba730
(gdb) c

Breakpoint 1, 0x004ba730 in cparser_cmd_vlan_set_pvid_inner_port_ports_all_pvid ()
(gdb) bt
#0 0x004ba730 in cparser_cmd_vlan_set_pvid_inner_port_ports_all_pvid ()

GDB is unable to find the start of the function at 0x546612

and thus can’t determine the size of that function’s stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
This problem is most likely caused by an invalid program counter or
stack pointer.
However, if you think GDB should simply search farther back
from 0x546612 for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post’ command.
#1 0x00546614 in ?? ()
(gdb)

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5680638.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存