Can LLDB be used on Sandboxed Apps

I have a sandboxed app in /Applications.

I'm attempting to shoot a problem with LLDB, so I cd to /Applications/app-name/Contents/MacOS and do lldb programname.

However, once I fire it off with "r" it dies instantly with:

error: process exited with status -1 (lost connection)

Should this work? Should I try signing the lldb executable?

Thanks!

Replies

Should this work?

Yes. And, indeed, it does work on my machine. I created a test project from the macOS > App template, which defaults to being sandboxed, and I was able to debug it with the command-line LLDB:

% codesign -d --entitlements - Test747110.app 
…
[Dict]
    [Key] com.apple.security.app-sandbox
    [Value]
        [Bool] true
    [Key] com.apple.security.files.user-selected.read-only
    [Value]
        [Bool] true
    [Key] com.apple.security.get-task-allow
    [Value]
        [Bool] true
% lldb Test747110.app
(lldb) target create "Test747110.app"
Current executable set to '…/Test747110.app' (arm64).
(lldb) r
Process 70203 launched: '…/Test747110.app/Contents/MacOS/Test747110' ```

This is Xcode 15.2 on macOS 14.2.1.

Are you sure that sandboxing is the only constraint here? If, for example, your sandboxed app was downloaded from the Mac App Store, you can’t debug that with LLDB.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"