使用 lldb 时,基本 C 程序的调试失败
程序是:hello.c
#include <stdio.h>
int main()
{
printf("Hello world\n");
return (0);
}
Run Code Online (Sandbox Code Playgroud)
编译后,链接并运行lldb,然后运行命令。显示错误
$ lldb hello
(lldb) target create "hello"
Current executable set to 'hello' (x86_64).
(lldb) run
error: process exited with status -1 (Error 1)
Run Code Online (Sandbox Code Playgroud)
非常感谢这方面的任何帮助
Jas*_*nda 12
您需要先在 Mac 上启用开发人员模式,然后才能进行调试。运行DevToolsSecurity -status以显示当前状态。当远程登录 (ssh) 或在 tmux 之类的东西下运行时,您可能无法调试东西,因为需要 UI 交互(以批准调试会话)。你也许能够运行DevToolsSecurity -enable或sudo DevToolsSecurity -enable?我不确定这些行为是否在不同的 macOS 版本上发生了变化。但一般情况下,屏幕上会弹出一个认证窗口,需要得到用户的批准才能允许调试会话工作。