栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

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

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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)

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/680057.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号