VSCode调试C++报错:LLDB意外退出(错误码134)求助
解决LLDB调试退出码134 (0x86)的问题
环境信息
- 设备:2015款MacBook Air
- 系统:macOS 10.13.6
- VSCode版本:1.74.0 (Universal)
- 已安装插件:C/C++、Code Runner
- 测试代码(编译成功,调试报错):
#include <iostream> using namespace std; int main() { cout << "Hello World!"; return 0; }
报错信息
Unable to start debugging. LLDB exited unexpectedly with exit code 134 (0x86)
当前配置文件
launch.json
"configurations": [ { "name": "C/C++: clang++ build and debug active file", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}", "args": [], "stopAtEntry": true, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "lldb", "preLaunchTask": "C/C++: clang++ build active file" } ]
tasks.json
{ "tasks": [ { "type": "cppbuild", "label": "C/C++: clang++ build active file", "command": "/usr/bin/clang++", "args": [ "-fcolor-diagnostics", "-fansi-escape-codes", "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "Task generated by Debugger." } ], "version": "2.0.0" }
解决方法
1. 降级C/C++插件版本
VSCode 1.74.0与新版C/C++插件在macOS 10.13.6这类旧系统上存在兼容性问题,尝试降级插件:
- 打开VSCode扩展面板,找到C/C++插件
- 点击插件右下角齿轮图标,选择「Install Another Version...」
- 选择v1.14.5版本安装,重启VSCode后重新调试
2. 调整launch.json配置
修改工作目录、控制台模式并指定LLDB调试器路径:
{ "name": "C/C++: clang++ build and debug active file", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}", "args": [], "stopAtEntry": true, "cwd": "${fileDirname}", // 与tasks.json工作目录保持一致 "environment": [], "externalConsole": true, // 切换为外部控制台 "MIMode": "lldb", "miDebuggerPath": "/usr/bin/lldb-mi", // 明确指定调试器路径 "preLaunchTask": "C/C++: clang++ build active file" }
3. 检查可执行文件权限
确保编译生成的程序有执行权限:
- 打开终端,进入C++Projects文件夹:
cd /你的项目路径/C++Projects - 执行命令:
chmod +x helloworld - 重新尝试调试
4. 禁用Code Runner插件
暂时关闭Code Runner插件,避免其与C/C++插件的调试功能产生冲突,重启VSCode后再调试
5. 更新LLDB版本(可选)
如果系统支持Homebrew,可安装新版LLDB替换系统自带版本:
- 安装Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - 安装LLDB:
brew install lldb - 修改tasks.json的编译命令为Homebrew安装的clang++路径,同时在launch.json中指定新的lldb-mi路径
内容的提问来源于stack exchange,提问作者marech0721
相关产品推荐
相关产品推荐

