vscode调试apollo
一、插件要求
二、通过插件进入容器
三、配置默认进入的目录和用户
快捷键Ctrl + Shit + P
如果不配置默认用户是root,运行不了apollo程序。
修改红框中的默认工作目录和用户名
{
"workspaceFolder": "/apollo",
"remoteUser": "chenjian",
"extensions": [
"BazelBuild.vscode-bazel",
"MS-CEINTL.vscode-language-pack-zh-hans",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cpptools-themes",
"twxs.cmake",
"zxh404.vscode-proto3"
]
}
四、配置调试文件
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "planning",
"type": "cppdbg",
"request": "launch",
"program": "/apollo/bazel-bin/cyber/mainboard/mainboard",
"args": ["-d" , "/apollo/modules/planning/dag/planning.dag"],
"stopAtEntry": false,
"cwd": "/apollo",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"miDebuggerPath": "/usr/bin/gdb"
}
]
}