iOS: symbolicatecrash is stuck - ios

symbolicatecrash is stuck.
I was trying to run it like this:
symbolicatecrash -v crash.txt MYAPP
The execution never ends. It used to work in the past but now (Xcode 7 and 8) it is stuck.
Is there a solution please?

Here is a solution:
The in-depth details appear here: iOS9: duplicated lines in crash reports are causing symbolicatecrash to get stuck
The quick solution is to edit this perl script (new location in Xcode 8!):
/Applications/Xcode.app//Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash
Now search for defined($images{$bundlename}) and add next; right after, like this:
if ( defined($images{$bundlename}) ) {
next;
That's all!
Some VERY USEFUL symbolication tips:
For symbolication you need 3 files:
A text file with the crash report: starting with Incident Identifier: and ending with something like 0x1974d0000 - 0x1974f3fff libxpc.dylib arm64 <ad580443238d39978d09004c210d0c18> /usr/lib/system/libxpc.dylib
The app folder, named MYAPP.app (the Finder hides the .app extension). If you have and IPA of the app, unzip it and it will be wishing the Payload folder.
The dSYM folder, as generated by Xcode while compiling.
You should rename the dSYM folder into MYAPP.app.dSYM and put all three files in the same folder.
All the three must have the same UUID. To verify that you can use the following commands (I got gsed by running brew install gnu-sed):
UUID of app: dwarfdump --uuid MYAPP.app/MYAPP
UUID of symbols: dwarfdump --uuid MYAPP.app.dSYM
UUID od crash:cat crash.txt | grep -A 1 "Binary Images:" | gsed -r -n -e 's_.*<([0-9a-z]{8})([0-9a-z]{4})([0-9a-z]{4})([0-9a-z]{4})([0-9a-z]{12}).*_\1-\2-\3-\4-\5_p' | awk '{print toupper($0)}'
Now, if they all match the same UUID, you can:
symbolicatecrash -v crash.txt MYAPP

Related

Trying to get the line of code from a specific crashlog

I'm trying to understand how to get the line of code from this line of a core data crash log (arm64)
I've been able to symbolicate it from :
0x0000000100922c94 0x10089c000 + 552084
to :
0x0000000100922c94 +[NSManagedObject(SBTMerge) objectForCode:entityName:context:mergeExisting:] + 552084 (NSManagedObject+SBTMerge.m:0)
but line 0 is the top of the file which doesn't make sense.
I've used atos and dwarfdump but I'm not able to get the line of code / offset using the load address "+ 552084"
Can anyone help me?
You have to symbolicate your crash log. So at least you ned .dSym file and .crash file, put this file in a single path. Then run a commands
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
cp -i /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash ./
./symbolicatecrash bug.crash > symbolicated.crash

Unable to symbolicate crash reports

I submitted a new version of my app to AppStore and it got rejected due to some crashes that I never experienced while testing the app.
Unfortunately I can't seem to be able to reproduce the issue so all I have to analyze the 2 unsymbolicated crash logs (.txt files) they sent me.
However, I am having problems symbolicating them.
Crash Log 1
Crash Log 2
I tried following the steps provided HERE and HERE, as well as other suggestions but no luck.
Here are the things I tried so far:
$ atos -arch arm64 -o Qlear.app.dSYM/Contents/Resources/DWARF/Qlear -l 0x1839fa000 0x0000000183a1c2e8
Unfortunately the command returns only 0x00000001000222e8 (in Qlear)
$ atos -arch arm64 -o 'Qlear.app'/'Qlear' 0x1839fa000
$ atos -arch arm64 -o 'Qlear.app.dSYM/Contents/Resources/DWARF/Qlear' 0x1839fa000
Both commands return 0x1839fa000
$ dwarfdump --uuid Qlear.app.dSYM
$ dwarfdump --uuid Qlear.app.dSYM/Contents/Resources/DWARF/Qlear
Both commands return
UUID: 4FFCBD15-01BA-366A-8C28-E4E613401616 (armv7) Qlear.app.dSYM/Contents/Resources/DWARF/Qlear
UUID: 97BD48FC-11E3-37C9-A081-700DCE0CDB23 (arm64) Qlear.app.dSYM/Contents/Resources/DWARF/Qlear
If I try $ dwarfdump --lookup 0x1839fa000 -arch arm64 Qlear.app.dSYM I get:
----------------------------------------------------------------------
File: Qlear.app.dSYM/Contents/Resources/DWARF/Qlear (arm64)
----------------------------------------------------------------------
Looking up address: 0x00000001839fa000 in .debug_info... not found.
Looking up address: 0x00000001839fa000 in .debug_frame... not found.
So in the end I thought the .dSYM files(I tried the one on my Mac as well as the one from iTunes Connect) are corrupted so I tried dwarfdump --all Qlear.app.dSYM but this seems to be working as it returns a lot of content.
Any ideas what I'm doing wrong here? Am I mixing up the commands, am I using the wrong hex?
Finally, after hours of searching I finally found a solution:
Change the crash logs extension from .txt to .crash.. This is very important since .txt files are not recognized. I was also unable to find any info on this while reading Apple documentation.
Connect an iOS device and start Xcode.
In Xcode, go to Windows > Devices and Simulators (Shift + CMD + 1)
Select the Devices tab and then View Devices Logs.
In the left pane, select This Device and then drag-n-drop the .crash files inside.
Wait for the files to load and get symbolicated. The logs can also be symbolicated manually after drag-n-drop: Right Click on the log > Re-Symbolicate Log.

Qt-creator examples fail to build for iphonesimulator

I've successfully installed Qt 5.7.0 and Qt-creator 4.1.0 on El Capitan with Xcode 8.
I fixed the xcode sdk-version errors from qt, and now I'm trying to build one of the examples for iphonesimulator. None of them work. All of them fail with error message of type:
The following build commands failed:
CopyPNGFile Debug-iphonesimulator/2dpainting.app/Default-568h#2x.png 2dpainting.xcodeproj/Default-568h#2x.png
I can confirm that directory Debug-iphonesimulator/2dpainting.app does not have the png-file, it's actually located somewhere within the qt installation directories. Copying the png to the source folder does not help as the folder gets overwritten upon running 'make'.
Any advice would be appreciated.
Edit:
The build kit warns about the following issue:
"Device type is not supported by the Qt version". Device type is 'iOS simulator'.
I had the same problem after I had updated my Xcode to version 8.0.
My first error was "Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild."
To solve this problem, I created a symbolic link:
cd /Applications/Xcode.app/Contents/Developer/usr/bin/
sudo ln -s xcodebuild xcrun
Then I got error "Project ERROR: Current iphonesimulator SDK version (10.0) is too old. Please upgrade Xcode."
I commented two strings out in file QT_DIR/5.7/ios/mkspecs/macx-ios-clang/features/sdk.prf
lessThan(QMAKE_MAC_SDK_VERSION, "8.0"): \
error("Current $$QMAKE_MAC_SDK SDK version ($$QMAKE_MAC_SDK_VERSION) is too old. Please upgrade Xcode.")
Then I got error about emulator. Qt could not find it. I replaced line of code in file QT_DIR/5.7/ios/mkspecs/macx-ios-clang/xcodebuild.mk from:
IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell xcrun simctl list devices | grep -E 'iPhone|iPad' | grep -v unavailable | perl -lne 'print $$1 if /((.*?))/' | tail -n 1)"
to:
IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell xcrun simctl list devices | grep -E 'iPhone|iPad' | grep -v unavailable | awk 'match ($$0, /\(([A-F0-9\-]*\))/ ) { print substr ($$0, RSTART+1, RLENGTH-2) }' | tail -n 1)"
And finally afer all of it I got error "The following build commands failed:
CopyPNGFile Debug-iphonesimulator/Test01.app/Default-568h#2x.png Test01.xcodeproj/Default-568h#2x.png"
This error occurred due to the fact that the system has two file xcrun. And script /Applications/Xcode.app/Contents/Developer/usr/bin/copypng starts one, which is a symbolic link. Then I changed path in this script
from:
my $PNGCRUSH = `xcrun -f pngcrush`;
to:
my $PNGCRUSH = `/usr/bin/xcrun -f pngcrush`;
And then I finally had built the project without errors and opened it in Xcode.
I had this stupid error and spent two days to nail down. I was about to downgrade Xcode and thought lets try one more time. Finally nailed down.
Symptom:
The simplest project wont build from Qt Creator. The error I would get: CopyPNG failed or something along the line and a hint '-f' unknown parameter.
Reason: xcrun takes both -f and -find from the terminal I can see, but it does not like -f from the script copypng. (copypng is a perl script by the way.)
The solution: Open the file /Applications/Xcode.app/Contents/Developer/usr/bin/copypng and find
my $PNGCRUSH = `xcrun -f pngcrush`;
changed to
my $PNGCRUSH = `xcrun -find pngcrush`;
PS: I dint have path problem with xcrun, if you have it'd be good to put the whole path as advised above.

otool -L filename/path not working

I'm running through some various programming/debugging tutorials and uses the "otool" command in terminal. An example is to check for shared libraries. The error is always one of two. I'm running it from the directory the file is located. Typing in just otool give the list of otool "-x" switches. I've gone down the list of switches on multiple files and directories and get the same errors.
What am I missing?
$ otool -L DemoApp
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: DemoApp (No such file or directory)
or
$ otool -L DemoApp.app
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't map file: DemoApp.app (Invalid argument)
you need to point to a final executable file. DemoApp.app is just a directory. Try otool -L ~/Applications/DemoApp.app/Contents/MacOS/DemoApp

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!
I have prepared a script which takes two parameters,
MyApp.crash
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:
create a file symbolicate in /usr/local/bin/
Put the above code in symbolicate file
set execute permission with chmod 777 symbolicate
Run from wherever in your location with proper params
output will be generated in same directory of crash file.
Plug an iOS Device into the Machine that contains the archive in the designated archives folder.
Open the devices window in Xcode.
Open device logs.
Drag an drop your crash report into the list of logs of the device. Wait until it gets resymbolicated.

Resources