Skip to content

Instantly share code, notes, and snippets.

@jadar
Created January 9, 2015 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jadar/7f4bd4497fdd6f1fa1f5 to your computer and use it in GitHub Desktop.
Save jadar/7f4bd4497fdd6f1fa1f5 to your computer and use it in GitHub Desktop.
Easy iOS Error Log Symbolication
#!/bin/bash
# Symbolicate Crash
# This script will symbolicate crash logs using your choice Xcode installation.
CRASH_PATH=$1
SYMBOL_PATH=$2
if [[ -z $CRASH_PATH ]]; then
printf "Where is the crash log? "
read -r CRASH_PATH
fi
if [[ ! -e $CRASH_PATH ]]; then
echo "$CRASH_PATH does not exist or is a directory!"
exit 1
fi
if [[ -z $SYMBOL_PATH ]]; then
printf "Where is the dYSM directory? "
read -r SYMBOL_PATH
fi
if [[ ! -d $SYMBOL_PATH ]]; then
echo "$SYMBOL_PATH does not exist or is not a directory!"
exit 1
fi
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
LOG_FILE="$DIR/symbolicate-errors.log"
rm -f LOG_FILE
DEVELOPER_DIR=$(xcode-select -print-path)
# DEVELOPER_DIR="$DEVELOPER_DIR/"
VALID_DIR=false
while [[ "$VALID_DIR" == false ]]; do
printf "Where is /Developer/ located? [$DEVELOPER_DIR] "
read -r NEW_DEVELOPER_DIR
if [[ -z "$NEW_DEVELOPER_DIR" ]]; then
NEW_DEVELOPER_DIR=$DEVELOPER_DIR
fi
if [[ -d "$NEW_DEVELOPER_DIR" ]]; then
# echo "exists"
DEVELOPER_DIR=$NEW_DEVELOPER_DIR
VALID_DIR=true
else
echo
echo "$NEW_DEVELOPER_DIR does not exist!"
echo
fi
done
export DEVELOPER_DIR="$DEVELOPER_DIR"
XCODE_DIR="/Applications/Xcode.app"
VALID_DIR=false
while [[ "$VALID_DIR" == false ]]; do
printf "Where is Xcode located? [$XCODE_DIR]"
read -r NEW_XCODE_DIR
if [[ -z "$NEW_XCODE_DIR" ]]; then
NEW_XCODE_DIR=$DEVELOPER_DIR
fi
if [[ -d "$NEW_XCODE_DIR" ]]; then
# echo "exists"
DEVELOPER_DIR=$NEW_XCODE_DIR
VALID_DIR=true
else
echo
echo "$NEW_XCODE_DIR does not exist!"
echo
fi
done
FILE_EXTENSION="${CRASH_PATH##*.}"
OUTPUT_PATH="${CRASH_PATH%.*}-resymbolicated.$FILE_EXTENSION"
# echo $OUTPUT_PATH
$XCODE_DIR/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash -o "$OUTPUT_PATH" "$CRASH_PATH" "$SYMBOL_PATH" 2> $LOG_FILE
if [[ $? == 0 ]]; then
echo "Successfully outputted symbolicated log to $OUTPUT_PATH"
else
echo "Failed to symbolicate log!"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment