使用lldb时,基本C程序的调试失败

该程序是:hello.c

#include <stdio.h>
int main()
{
printf("Hello world\n");
return (0);
}

编译后,先链接并运行lldb,然后运行run命令。
显示错误
$ lldb hello

(lldb) target create "hello"

Current executable set to 'hello' (x86_64).

(lldb) run

error: process exited with status -1 (Error 1)

非常感谢这方面的任何帮助

最佳答案

您需要先在Mac上启用开发人员模式,然后才能进行调试。运行DevToolsSecurity -status以显示当前状态。在远程登录(ssh)或在tmux之类的环境下运行时,由于可能需要UI交互(以批准调试 session ),因此您可能无法调试内容。您也许可以运行DevToolsSecurity -enablesudo DevToolsSecurity -enable?我不确定这些行为是否在不同的macOS版本上发生了变化。但通常,在允许调试 session 运行之前,屏幕上会弹出一个身份验证窗口,并且需要得到用户的批准。

关于c - lldb给出错误 "error: process exited with status -1 (Error 1)",我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57944268/

10-13 07:20