简体   繁体   中英

lldb gives error "error: process exited with status -1 (Error 1)"

Debugging of a basic C program fails when using lldb

The program is: hello.c

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

After compilation, linking and running lldb and then the run command. An error is shown

$ lldb hello

(lldb) target create "hello"

Current executable set to 'hello' (x86_64).

(lldb) run

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

Any help in this regard is much appreciated

You need to enable developer mode on a mac before you can debug something. Run DevToolsSecurity -status to display the current state. When logging in remotely (ssh) or running under something like tmux, you may not be able to debug things because UI interaction (to approve the debug session) is required. You may be able to run DevToolsSecurity -enable or sudo DevToolsSecurity -enable ? I'm not sure if these behaviors have changed over different macOS versions. But in general, an auth window pops up on the screen and needs to be approved by the user before the debug session is allowed to work.

使用csrutil disable禁用 SIP 对我csrutil disable

In my case it was a custom lldb that didn't work, even with

DevToolsSecurity -enable

Using the one that came with XCode / from brew I don't remember, but the one at

 /usr/bin/lldb

solved it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM