启动调试会话时 MacOS 上的 VSCode LLDB 错误 [英] VSCode LLDB on MacOS error when starting debugging session

查看:281
本文介绍了启动调试会话时 MacOS 上的 VSCode LLDB 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试配置 VSCode 以在 MacOS 上编译/调试 C++ 程序.我正在使用以下 launch.json 文件:

当我尝试启动调试会话时,出现以下错误:

警告:未检测到调试对象 TargetArchitecture,假设为 x86_64.错误:无法开始调试.命令-exec-run"的意外 LLDB 输出.过程退出状态 -1(附加失败((os/kern)无效参数))程序/path/to/Development/C++/helloworld/main"已退出,代码为 42(0x0000002a).

值得一提的是,我使用的是 M1 Macbook,所以 x86_64 不是正确的架构.我假设这是错误的原因.

我似乎在网上的任何地方都找不到对此错误的任何参考,有人知道我该如何解决吗?

添加targetArchitecture":ARM64";删除了警告,但没有修复错误.

解决方案

我遇到了同样的问题,我发现 VScode 还不支持 ARM64 二进制文件的调试器.这是问题link.

但是,如果您使用其他扩展程序,它会起作用.安装 CodeLLDB 并在 launch.json 上设置 "type":"lldb" 如下.

{//使用 IntelliSense 了解可能的属性.//悬停以查看现有属性的描述.//更多信息,请访问:https://go.microsoft.com/fwlink/?linkid=830387版本":0.2.0",配置":[{名称":clang++ - 构建和调试活动文件",类型":lldb",请求":启动",程序":${fileDirname}/${fileBasenameNoExtension}",参数":[],cwd":${workspaceFolder}",preLaunchTask":clang++ 构建活动文件"}]}

您可以查看 快速入门 vscode-lldb 存储库指南.>

请注意,preLaunchTask 的值应与 task.json 中标签的值相同.

I'm trying to configure VSCode for compiling/debugging C++ programs on MacOS. I am using the following launch.json file:

When I try and start a debugging session, I get the following error:

Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process 
exited with status -1 (attach failed ((os/kern) invalid argument))
The program '/path/to/Development/C++/helloworld/main' has exited with code 42 
(0x0000002a).

It is worth mentioning that I am using an M1 Macbook, so x86_64 is not the correct architecture. I'm assuming that this is the reason for the error.

I can't seem to find any reference to this error anywhere online, does anyone know how I can solve this?

Edit: Adding "targetArchitecture": "ARM64" removed the warning, but does not fix the error.

解决方案

I had the same problem and I found that VScode does not support a debugger for ARM64 binaries yet. Here is the issue link.

However, it works if you use another extension. Install CodeLLDB and set "type": "lldb" on launch.json like below.

{
    // 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": "clang++ - Build and debug active file",
        "type": "lldb",
        "request": "launch",
        "program": "${fileDirname}/${fileBasenameNoExtension}",
        "args": [],
        "cwd": "${workspaceFolder}",
        "preLaunchTask": "clang++ build active file"
      }
    ]
  }

You can check quick start guide of vscode-lldb repository.

Note that preLaunchTask's value should be the same as the label's value in your task.json.

这篇关于启动调试会话时 MacOS 上的 VSCode LLDB 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆