![](/img/trans.png)
[英]'Starting LLDB server' when debugging c++ in Android studio
[英]VSCode LLDB on MacOS error when starting debugging session
我正在嘗試配置 VSCode 以在 MacOS 上編譯/調試 C++ 程序。 我正在使用以下 launch.json 文件:
當我嘗試啟動調試 session 時,出現以下錯誤:
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).
值得一提的是,我使用的是 M1 Macbook,所以 x86_64 不是正確的架構。 我假設這是錯誤的原因。
我似乎無法在網上的任何地方找到任何關於此錯誤的參考,有誰知道我該如何解決這個問題?
編輯:添加“targetArchitecture”:“ARM64”刪除了警告,但沒有修復錯誤。
我遇到了同樣的問題,我發現 VScode 還不支持 ARM64 二進制文件的調試器。 這是問題鏈接。
但是,如果您使用其他擴展程序,它會起作用。 安裝CodeLLDB並在啟動時設置"type": "lldb"
。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": "clang++ - Build and debug active file",
"type": "lldb",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"cwd": "${workspaceFolder}",
"preLaunchTask": "clang++ build active file"
}
]
}
您可以查看 vscode-lldb 存儲庫的快速入門指南。
請注意,preLaunchTask 的值應與 task.json 中標簽的值相同。
使用命令使可執行文件:
gcc file_name.c -g
發射.json
"targetArchitecture": "x86_64",
使用 cargo 的配置而不是“程序”為我解決了它(使用 Rust 和 LLDB)。
{
"name": "(OSX) Launch",
"type": "lldb",
"request": "launch",
"cargo": {
"args": ["build", "--manifest-path", "${fileDirname}/../Cargo.toml"]
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.