Execute symbolicatecrash from shell script

2019-05-26 12:06发布

问题:

I am trying to call symboliccrash from a shell script that loops through multiple crash log file and outputs symbolicated version, but it is failing with an error message saying "command not found"

But it works fine in the command line.

symboliccrash CRASH_FILE.crash APP.dSYM > symbolicated.crash

I tried to find the source for symboliccrash but it fails to find it

which -a symboliccrash

Shell Script Code

#!/usr/bin/bash
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
i=0

for x in *.crash;
do
        symboliccrash $x MyApp.dSYM > $i.crash
        i=$((i+1))
done

Response

compareUUD.sh: line 7: symboliccrash: command not found

Any idea how i can do this.

回答1:

I think that you need first of all is execute this command

find /Applications/Xcode.app -name symbolicatecrash -type f

on your Terminal, this will retrieve the localization of your symbolicatecrash something like this

/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash

then you need to update your script to this code

#!/usr/bin/bash
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"

alias symbolicatecrash='/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash'

i=0

for x in *.crash;
do
        symbolicatecrash $x MyApp.dSYM > $i.crash
        i=$((i+1))
done

and replace the direction of symbolicatecrash for the result given by the execution of find /Applications/Xcode.app -name symbolicatecrash -type f

and that is it,execute with sudo sh, I tested and result in this error

No crash report version in 0.crash at /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash line 1007.

But I asume that this error is because I don't have any crash or dSYM so I think that now is working, I hope this help you