[lldb-dev] lldb: how can I make it reliably scriptable?

jingham at apple.com jingham at apple.com
Wed Feb 18 12:13:15 PST 2015


The xcodebuild is pretty simple, you just check out the sources, cd to the top level of lldb and do:

$ xcodebuild -configuration Debug

or if you want a debug version of Clang as well use "DebugClang" or if you want a release version "Release".

However, either way you try (cmake or xcodebuild) you're going to have some problems building a debugserver that the system will trust.  Building a code-signed debugserver is not that hard.  You have to make the cert (as described in lldb/doc/code-signing.txt.)  I'm sure there's some command-line way to do this, but I don't know what it is.  This is a one-time thing however, so you can use Apple Remote Desktop to do that, and then do all your builds in the ssh session.  The next bit is that to use the cert for code signing the build process will have to have access to your login keychain, which is unlocked by default for a GUI session, but not an ssh session.  That's easy, just do:

$ security unlock-keychain

before building.

The trickier part is that there's really no good way to authenticate a hand-built debugserver from an ssh session.  Normally, the first time you try to use a hand-built debugserver, it will issue the request to debug, which will go to the kernel, and that will ask out to some daemon for authentication, which will put up an authorization dialog.  There's no way to do that in an ssh session.  There are API's to enter the authorization manually on the command line, but this has to happen in debugserver, which has no access to a terminal.

However, there are special rules for Apple codesigned debugservers.  If you just use Xcode to debug something once from a GUI session on the machine, it will do all the necessary setup for you.  Again, this is a one-time thing, so you can do this once with ARD and then you won't need to do it again till you reinstall your OS...  So it may be simpler to build lldb, then copy the debugserver from your Xcode installation (it's in Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources) to your lldb build.

Jim



> On Feb 18, 2015, at 11:09 AM, Paul Smith <paul at mad-scientist.net> wrote:
> 
> On Mon, 2015-02-16 at 14:56 -0800, Enrico Granata wrote:
>> a) is there any chance you can compile LLDB from sources and use that
>> debugger to perform your automation?
>> 
> Is there any way to build the latest LLDB on OSX from the command line?
> I don't have an OSX system in front of me, I just ssh into one of the
> Mac systems in our build/test rack.  The build instructions seem to
> assume I have a full graphical Xcode available.
> 
> Is there an xcodebuild invocation I can use from the CLI to build LLDB,
> instead?  I tried a few things but wasn't successful (I'm no guru when
> it comes to Xcode, in any form).
> 
> Cheers!
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev





More information about the lldb-dev mailing list