最近使用Mac-mini-m1芯片的电脑在debug代码。
使用的VSCODE进行调试,launch.json 也设置好了,但是启动调试的时候总会出现:ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (attach failed) 这样的问题。不过在VSCODE外头通过lldb ./demo 是可以的。
不过还是找到了解决方案…
在M1芯片下,ARM64调试C++的代码需要这样搞:
首先安装这个插件:
然后修改一些launch.json 如下就OK了:
{
"version": "0.2.0",
"configurations": [
{
"name": "clang++ - Build and debug active file",
"type": "lldb",
"request": "launch",
"program": "./benchncnn",
"stopAtEntry": true,
"cwd": "/Users/oldpan/deps/ncnn/build_debug/benchmark/",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"targetArchitecture": "arm64"
}
]
}
成功debug!
参考链接:
- https://www.programmersought.com/article/42826675760/
|