Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run iOS apps in an lldb session #77

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion bin/run_ios_app
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
#!/usr/bin/env sh

tmpdir="$(mktemp -dt "$(basename "$0")")"
trap "rm -rf $tmpdir" EXIT

build_path=$(xcodebuild -showBuildSettings "$@" 2>/dev/null | egrep "\bBUILD_DIR\b" | sed -E "s/[[:space:]]+BUILD_DIR = //")
app_path=$(find "$build_path" -iname "*.app" | head -n1)
app_id=$(defaults read "$app_path/Info" "CFBundleIdentifier")
executable_name=$(defaults read "$app_path/Info" "CFBundleExecutable")
executable_path="$app_path/$executable_name"
lldb_script_path="$tmpdir/launch_ios_app.lldb"
uuid=$(xcrun simctl list devices | grep "$SIMULATOR" | head -n1 | grep -E "[0-9A-F-]{8,}" -o)

xcrun instruments -w "$uuid" 2>/dev/null

xcrun simctl install booted "$app_path"
xcrun simctl launch booted "$app_id"

cat >"$lldb_script_path" <<EOF
process launch -s
b -[UIApplication _run]
continue
platform shell xcrun simctl launch booted $app_id
continue
EOF

lldb -f "$executable_path" -s "$lldb_script_path"