Reputation: 491
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
Upvotes: 14
Views: 3648
Reputation: 371
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.
Upvotes: 1
Reputation: 15375
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.
Upvotes: 16