Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to symbolicate crash logs using the .xcarchive file?

I am having issues extracting the dsym file from .xcarchive to symbolicate crash logs. I understand that .xcarchive contains both the .app files and .dsym files. Normally you should be able to right click on the xcarchive file and selecct "Show Package Contents" (link). However "Show Package Contents" does not show up for me.

I also attempted to symbolicate the crash logs manually by using symbolicatecrash and giving it the xcarchive file (link). However it would still return crash logs that were not symbolicated.

Would anyone know what could be going on here? Any help is appreciated, Thank you!

like image 708
KrispyDonuts Avatar asked Nov 09 '22 23:11

KrispyDonuts


1 Answers

I have prepared a script which takes two parameters,

  1. MyApp.crash
  2. MyApp.xcarchive

And gracefully output the MyApp_symbolicated.crash

Scripts:

#!/bin/bash

if [ "$#" -ne 2 ]; then
        echo "Argument missing [symbolicate @logLocation @xcarchiveLocation]"
        exit 0
fi

if test -e "$1"; then
    echo "$1 exists"
else
    echo "$1 does not exist!"
    exit 1
fi

if test -e "$2"; then
    echo "$2 exists"
else
    echo "$2 does not exist!"
    exit 1
fi

parentdir=`pwd`
export DEVELOPER_DIR=`xcode-select -p`
PATH=$PATH:$DEVELOPER_DIR
echo $PATH
cd $DEVELOPER_DIR
cd ../SharedFrameworks/
commanddir=`pwd`
command=$commanddir/`find . -name symbolicatecrash`
cd $parentdir
crashlog="$1"
archive="$2"
outputdir=`dirname "$crashlog"`
nfile=$(echo $1 | rev | cut -f 2- -d '.' | rev)
outputfile="$nfile"_symbolicated.crash
echo $nfile
desymfile="$archive"/dSYMs/*.dSYM
$command -v "$crashlog" "$desymfile" > "$outputfile"

How to use:

  1. create a file symbolicate in /usr/local/bin/
  2. Put the above code in symbolicate file
  3. set execute permission with chmod 777 symbolicate
  4. Run from wherever in your location with proper params

output will be generated in same directory of crash file.

like image 168
Sazzad Hissain Khan Avatar answered Nov 14 '22 22:11

Sazzad Hissain Khan