本篇講解如何使用gdbserver對目標(biāo)開發(fā)板上的程序進(jìn)行遠(yuǎn)程調(diào)試。
安裝 GDBSERVER
首先在開發(fā)板上安裝 gdbserver:
apt install gdbserver
gdbserver 用法
gdbserver用法描述:
Usage: gdbserver [OPTIONS] COMM PROG [ARGS ...]
gdbserver [OPTIONS] --attach COMM PID
gdbserver [OPTIONS] --multi COMM
COMM may either be a tty device (for serial debugging),
HOST:PORT to listen for a TCP connection, or '-' or 'stdio' to use
stdin/stdout of gdbserver.
PROG is the executable program. ARGS are arguments passed to inferior.
PID is the process ID to attach to, when --attach is specified.
Operating modes:
--attach Attach to running process PID.
--multi Start server without a specific program, and
only quit when explicitly commanded.
--once Exit after the first connection has closed.
--help Print this message and then exit.
--version Display version information and exit.
使用gdbserver很簡單,主要就是先在開發(fā)板上開啟gdbserver,然后宿主機運行gdb遠(yuǎn)程連接到gdbserver。
具體步驟
一:在目標(biāo)開發(fā)板上啟動 gdbserver 服務(wù)
要進(jìn)行gdb調(diào)試,首先要在目標(biāo)開發(fā)板上啟動gdbserver服務(wù)。在gdbserver所在目錄下輸入命令:
gdbserver :12345 helloworld
此時gdbserver監(jiān)聽端口號12345,并等待客戶端連接。這里的 端口號是自己指定的,helloworld是你要調(diào)試的程序 。
二:在宿主機上運行 GDB:
宿主機通常就是在你的Linux虛擬機上,然后找到開發(fā)板對應(yīng)工具鏈下的gdb,然后運行:
riscv64-linux-gnu-gdb helloworld
(gdb) target remote 192.168.1.4:12345
192.168.1.4是開發(fā)板的ip地址,12345是開發(fā)板啟動gdbserver服務(wù)時指定的端口號。
-
Linux
+關(guān)注
關(guān)注
88文章
11581瀏覽量
217173 -
開發(fā)板
+關(guān)注
關(guān)注
25文章
6027瀏覽量
110728 -
GDBServer
+關(guān)注
關(guān)注
0文章
5瀏覽量
2502
發(fā)布評論請先 登錄
飛凌嵌入式ElfBoard ELF 1板卡-在ELF 1開發(fā)環(huán)境中使用QT Creator進(jìn)行遠(yuǎn)程調(diào)試
嵌入式學(xué)習(xí)-飛凌嵌入式ElfBoard ELF 1板卡-在ELF 1開發(fā)環(huán)境中使用QT Creator進(jìn)行遠(yuǎn)程調(diào)試
【Aworks280試用體驗】Eclipse與Aworks280的遠(yuǎn)程調(diào)試
迅為i.MX6ULL開發(fā)板移植Gdb+Gdbserver調(diào)試
使用Qt Creator提供的遠(yuǎn)程部署調(diào)試的方法
使用gdb遠(yuǎn)程調(diào)試嵌入式主板程序分享
基于STM32野火開發(fā)板上的源程序
GDB RSP協(xié)議與USB通信進(jìn)行調(diào)試信息交互的開發(fā)與實現(xiàn)方法
嵌入式Linux系統(tǒng)的GDB遠(yuǎn)程調(diào)試的實現(xiàn)
Linux應(yīng)用的GDB調(diào)試的原理及過程分析
使用Qt Creator遠(yuǎn)程調(diào)試部署應(yīng)用到嵌入式linux開發(fā)板
如何使用VSCode+gdbserver遠(yuǎn)程調(diào)試ZMC900E
【干貨分享】在M-K1HSE開發(fā)板上使用SecureCRT工具進(jìn)行調(diào)試

如何使用gdbserver對目標(biāo)開發(fā)板上的程序進(jìn)行遠(yuǎn)程調(diào)試
評論