Debug an iOS app with LLDB from a cloud sandbox
# Debug an iOS app with LLDB from a cloud sandbox
A cloud sandbox has no iOS simulator, so a crash cannot be stopped under LLDB there. box launches the app under LLDB on a real Mac, sets the breakpoints you name, and prints the stack at each stop.
Run it
box debug -b ContentView.addOne --tap-id add
The breakpoint has to be on code the app actually runs. A SwiftUI View.body is not a reliable place to stop, and a line that never executes at launch will not be hit. Put the code you care about in a method and break on the method, then use --tap-id or --tap-label to reach it.
A real run, job bj_jsMui92dcp91HZzY, attached, set the breakpoint and stopped there:
debug: attached to com.xenoci.box.BoxDemo pid 3484
breakpoint 1: ContentView.addOne (pending until the code loads)
tap {"id": "add"} try 1 rc=0
== stop 1: thread 1, breakpoint 1.1
stack:
#0 ContentView.addOne() at BoxDemoApp.swift:36
#1 closure #2 in closure #1 in closure #1 in ContentView.body.getter at BoxDemoApp.swift:27
box: bj_jsMui92dcp91HZzY succeeded, 180s billed, $0.15
The tap landed and the breakpoint stopped inside ContentView.addOne. The report box writes is .box/out/<job>/debug.txt.
What it costs
$0.05 per minute of build and test time on iOS, every started minute. The run above was three minutes. A run that ends because the Mac could not be prepared costs nothing.
How else people do this
Debugging in Xcode needs a Mac. GitHub-hosted macOS runners cost 10 times the Linux per-minute rate and do not give you an LLDB session (https://docs.github.com/en/billing/reference/actions-runner-pricing).
Apple, Mac, macOS, iPhone, Xcode, Swift and SwiftUI are trademarks of Apple Inc., registered in the U.S. and other countries and regions. box is an independent service and is not affiliated with, sponsored or endorsed by Apple Inc.