在VSCODE中使用GDB调试时如何加载符号
环境:Windows 10上的WSL Ubuntu20.04
GDB:GDB-Multiarch(GNU GDB 9.2)
vscode版本:1.67.0
我正在尝试在VSCODE上使用GDB进行调试。 如果我在ubuntu中使用命令行与GDB服务器连接,并将Symboal加载到我的目标设备。它正常工作。
$gdb-multiarch main
$(gdb)target remote:2331
$(gdb)load
$(gdb)c
ubuntu command-line上的屏幕快照(正常工作)
但是,我想在vscode上做同样的事情。
修改我的启动。JSON文件后,VSCODE中的GDB调试器只能“附加” 到我的目标设备。 没有加载的符号。这是我的启动.json 。
"configurations": [
{
"name": "GDB Launch",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/main",
"stopAtEntry": true,
"linux": {
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb-multiarch",
"miDebuggerServerAddress": "localhost:2331"
},
}
]
我是否想念需要在配置中填写的任何属性?
感谢您的任何评论和帮助:)
Environment: WSL Ubuntu20.04 on Windows 10
GDB: gdb-multiarch (GNU gdb 9.2)
VSCODE version: 1.67.0
I'm trying to debug with GDB on VSCODE.
If I use command-line in Ubuntu to connect with GDB server and load symboal to my target device. It works normally.
$gdb-multiarch main
$(gdb)target remote:2331
$(gdb)load
$(gdb)c
Screenshot on Ubuntu command-line (Works normally)
However, I wanna do the same thing on VSCODE.
After modifying my launch.json file, the GDB debugger in VSCODE can only "attach" to my target device. There is no any symbol loaded. Here is my launch.json.
"configurations": [
{
"name": "GDB Launch",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/main",
"stopAtEntry": true,
"linux": {
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb-multiarch",
"miDebuggerServerAddress": "localhost:2331"
},
}
]
Did I miss any propertey which needs to be filled in the configurations?
Thanks for any comments and helping:)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以打开日志以查看发生了什么:
可能会有一些影响符号负载的配置,例如
solib-search-path
,sysroot
,您可以检查并添加setupCommands
中的配置You can open logs to see what happened:
There may be some configurations that affect the symbol load, such as
solib-search-path
,sysroot
, you can check and add the configs insetupCommands