Can't debug "hello, world" with stock lldb from XCode 5?

I just installed a fresh copy of Mac OS X 10.9, and on that, XCode 5.
Alas, it doesn't seem to be able to debug a trivial C program:

$ lldb --version
$ gcc -g hello.c
$ lldb ./a.out
2014-01-29 13:42:20.095 lldb[273:262f] Metadata.framework [Error]:
couldn't get the client port
Current executable set to './a.out' (x86_64).
(lldb) run
Process 3511 launched: './a.out' (x86_64)
error: initial process state wasn't stopped: exited

Can I buy a clue?


You must have made your "lldb_codesign" prior to installing 10.9?

If you didn't please follow the instructions:

    % svn cat

If you already have a "lldb_codesign", it now needs to be marked as trusted again after the recent OS install. This is easier than doing everything from scratch, you just need to do:

- Launch /Applications/Utilities/Keychain
- Drag the existing "lldb_codesign" code signing certificate from the "login" keychain to the "System" keychain in the
- In the Keychain Access GUI, click and drag "lldb_codesign" in the "System" keychain onto the desktop. The drag will create a "~/Desktop/lldb_codesign.cer" file used in the next step.
- Switch to Terminal, and run the following:

% sudo security add-trust -d -r trustRoot -p basic -p codeSign -k /Library/Keychains/System.keychain ~/Desktop/lldb_codesign.cer
% rm -f ~/Desktop/lldb_codesign.cer

- Drag the "lldb_codesign" certificate from the "System" keychain back into the "login" keychain
- Quit Keychain Access
- delete your old LLDB build folder as it has been code signed by an invalid code signature and will be cached by the kernel
- Reboot

You can also run lldb with "sudo" and it will work regardless of the code signing...

The comments below are only if you are building your own LLDB from sources, so please ignore this if you are using a stock Xcode that was installed from the App Store...

If you are using a stock Xcode, try rebooting and see if that helps.


If you are ssh or using telnet, you can authorize yourself to be able to debug with:

% sudo /usr/sbin/DevToolsSecurity --enable

Otherwise, the first time you debug on a machine, it will pop up an authentication dialog box asking you for your password.

Aha, that looks helpful. I was indeed using ssh.

Last time I tried that didn't work for me, I had to setuid the debugserver binary as root instead.

Richard Mitton

Where does Apple install its debugserver binary?