[英]J-Link GDB debugging in CLion
不久前,CLion 添加了對遠程 GDB 調試的支持,我正在嘗試使用 Seggers 的 J-Link GDB 服務器進行設置。
我的設置:
我通常在 Windows 中工作,但由於 CLion 不支持 Windows 中的遠程 GDB,我試圖讓它在 VirtualBox 中運行 Ubuntu。 我在 CLion 中配置了調試器,如圖所示,並從上面鏈接中的博客中獲得了一些幫助。 我使用的參數基於 J-Link 文檔(文檔:UM08001)和一些猜測。 GDB 服務器設置
我的問題是,當運行調試器時,進程會停止並且 CLion 的控制台輸出:
“無法連接到目標。請檢查電源、連接和設置。”
我試圖從終端運行 JLinkGDBServer 然后我得到了這個:
/usr/bin/JLinkGDBServer -device nrf51422_xxAC -if swd -speed 1000 -endian little
SEGGER J-Link GDB Server V6.10 Command Line Version
JLinkARM.dll V6.10 (DLL compiled Sep 14 2016 16:46:16)
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 2331
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection: yes
Generate logfile: off
Verify download: off
Init regs on start: off
Silent mode: off
Single run mode: off
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: nrf51422_xxAC
Target interface: SWD
Target interface speed: 1000kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 5 2016 08:42:09
Hardware: V1.00
S/N: 681666518
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 2331
Connecting to target...Connected to target
Waiting for GDB connection...
有沒有人知道我做錯了什么?
您可能混淆了 GDB 服務器和 GDB 本身。 這些是應該在 CLion 的 GDB 遠程調試配置中設置的 GDB 選項,而不是 GDB 服務器設置。
也就是說,您首先手動運行 JLinkGDBServer,例如,從終端運行,就像您已經完成的那樣,然后讓它等待 GDB 附加。 此時應該注意連接端口:
Listening on TCP/IP port 2331 Connecting to target...Connected to target Waiting for GDB connection...
然后在 CLion 中編輯您的 GDB 遠程調試配置以使用主機 GDB(在您的情況下很可能是/usr/bin/gdb
,如有必要,請使用sudo apt install gdb
進行sudo apt install gdb
),並使用上面提到的端口作為“目標”的一部分遠程”字符串:
/usr/bin/gdb
:2331
注意端口前面的冒號。 這是使用 TCP 連接到 localhost 的簡寫。 以防萬一,顯式形式是tcp:localhost:2331
。
現在您可以啟動調試會話。 CLion 將啟動配置好的主機 GDB,GDB 通過指定的 TCP 連接與 JLinkGDBServer 通信,最后 GDB 服務器與您的設備聊天。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.