lldb给出错误“错误:进程退出,状态为-1(错误1)”

时间:2019-09-15 12:50:40

标签: c lldb

使用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)

在这方面的任何帮助都将受到赞赏

3 个答案:

答案 0 :(得分:2)

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

答案 1 :(得分:0)

使用csrutil disable禁用SIP对我有用。

答案 2 :(得分:0)

就我而言,这是一个自定义的 lldb,即使使用

DevToolsSecurity -enable

使用 XCode 附带的那个 / 来自 brew 我不记得了,但是那个在

 /usr/bin/lldb

解决了。