【发布时间】:2020-03-07 08:08:46
【问题描述】:
我正在尝试在 MacOS Catalina 上使用 lldb 和 VSCode 设置 C++ 调试器。我能够成功编译我的源代码以输出可执行文件和 .dSYM 文件,并通过 VSCode launch.json 和 tasks.json 文件启动调试器。但是,我无法在我的编辑器中设置断点并将它们反映在调试器窗口中。该程序只是一直运行。
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++ build and debug ARMsim",
"type": "cppdbg",
"request": "launch",
"program": "ARMsim",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "lldb",
"preLaunchTask": "g++ build ARMsim"
}
]
}
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "g++ build ARMsim",
"command": "/usr/bin/g++",
"args": [
"-g",
"${workspaceFolder}/ARMsim.cpp",
"-o",
"${workspaceFolder}/ARMsim"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
}
]
}
Program source code, note breakpoints on lines 9 and 10.
我唯一的想法是这与 .dSYM 文件有关。要么我的断点没有反映在其中,要么没有加载到 lldb 中,或者我误解了这一切是如何工作的。我已经看到有关此问题的其他 StackOverflow 帖子,但我确实使用 -g 标志进行编译,并且正在创建我的符号文件。
【问题讨论】:
标签: c++ debugging visual-studio-code lldb