1On MacOSX lldb needs to be code signed. The Debug, DebugClang and Release
2builds  are set to code sign using a code signing certificate named
3"lldb_codesign".
4
5If you have re-installed a new OS, please delete all old lldb_codesign items
6from your keychain. There will be 3: a code signing certification and a public
7and private key. Reboot after deleting them. You will also need to delete and
8build folders that contained old signed items. The darwin kernel will cache
9code sigining using the executable's file system node, so you will need to
10delete the file so the kernel clears its cache.
11
12If you don't have one yet you will need to:
13- Launch /Applications/Utilities/Keychain Access.app
14
15- In Keychain Access select the "login" keychain in the "Keychains"
16  list in the upper left hand corner of the window.
17
18- Select the following menu item:
19
20	Keychain Access->Certificate Assistant->Create a Certificate...
21
22- Set the following settings
23
24	Name = lldb_codesign
25	Identity Type = Self Signed Root
26	Certificate Type = Code Signing
27
28- Click Create
29- Click Continue
30- Click Done
31- Click on the "My Certificates"
32- Double click on your new lldb_codesign certificate
33- Turn down the "Trust" disclosure triangle, scroll to the "Code Signing" trust
34  pulldown menu and select "Always Trust" and authenticate as needed using your
35  username and password.
36- Drag the new "lldb_codesign" code signing certificate (not the public or private
37  keys of the same name) from the "login" keychain to the "System" keychain in the
38  Keychains pane on the left hand side of the main Keychain Access window. This will
39  move this certificate to the "System" keychain. You'll have to authorize a few
40  more times, set it to be "Always trusted" when asked.
41- Remove "~/Desktop/lldb_codesign.cer" file on your desktop if there is one.
42- In the Keychain Access GUI, click and drag "lldb_codesign" in the "System" keychain
43  onto the desktop. The drag will create a "~/Desktop/lldb_codesign.cer" file used in
44  the next step.
45- Switch to Terminal, and run the following:
46
47sudo security add-trust -d -r trustRoot -p basic -p codeSign -k /Library/Keychains/System.keychain ~/Desktop/lldb_codesign.cer
48rm -f ~/Desktop/lldb_codesign.cer
49
50- Drag the "lldb_codesign" certificate from the "System" keychain back into the
51  "login" keychain
52- Quit Keychain Access
53- Reboot
54- Clean by removing all previously creating code signed binaries and rebuild
55  lldb and you should be able to debug.
56
57When you build your LLDB for the first time, the Xcode GUI will prompt you for permission
58to use the "lldb_codesign" keychain. Be sure to click "Always Allow" on your first
59build. From here on out, the "lldb_codesign" will be trusted and you can build from the
60command line without having to authorize. Also the first time you debug using a LLDB that
61was built with this code signing certificate, you will need to authenticate once.
62