Programmatic Symbolication of Crash Logs - xcode

I am attempting to symbolicate crash logs that I have automatically sent to a server. My app's crash logs and dSYM files are sent to the server upon my app crashing. The issue I am having is symbolicating them. I would like to do this programmatically so that the process can be automated. Thus I am trying to use the symbolicatecrash terminal command as a subprocess in a python script. But before I even try to implement that, I need to get symbolicatecrash working properly. entering the following command is unsuccessful;
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash -o /Users/aj/Documents/symbolicatedcrash.crash com.COMPANYNAME.TEST_APP.crash TEST_APP.app.dSYM
I use the -o option to write the output to a file. Entering this code does not return an error. The output file is created, the crash log is just not symbolicated.
From researching peoples' similar questions, I've found that downloading the .ipa file and unzipping it can help. I have done so and found that the symbolicatecrash command does indeed symbolicate if the .app file is on the server.
My issue is that I do not want to download the .ipa file. Downloading it every time there is a new crash (or at least a new build) would be inefficient for the server. I would just like to download the dSYM and crash file itself upon each app crash.
My question is ultimately then: Can I symbolicate a crash log by using just the dSYM file? If so, can it be done with the symbolicatecrash terminal command?
Thanks

after further experimentation, I found that you indeed need the .ipa file or the archived app binaries to fully symbolicate the crash log.
you do not need to include those files in the terminal command though; The example I gave in the question works if you have the app binaries anywhere on your computer. The command will use spotlight to find the app binaries, and then return a fully symbolicated crash log.
note: it important that your binaries/crash log/dSYM files all come from the same build to have a fully symbolicated log.

Related

"GPU process isn't usable. Goodbye."

I'm experimenting with building a Windows and Mac OS app using Electron and have hit a snag.
In short, if I try to run the application directly with Electron on Mac OS Big Sur (as opposed to building a Mac app and then running that) I get the following error returned:
[35941:0821/171720.038162:FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable. Goodbye.
I am running directly with Electron using the following in my package.json:
"scripts": {
...
"test": "electron main.js",
...
}
So far the only Mac OS environment I have access to is Big Sur so haven't tried this on earlier versions of Mac OS but from Googling it seems this error may be related to Big Sur's tightened security/sandbox constraints -- but I am guessing about that.
In any case, after some Googling several suggestions indicated trying to run without the app sandbox, i.e. adding this to main.js:
app.commandLine.appendSwitch('no-sandbox');
That's all well and good and works.
However, if I ever want to build and distribute a signed Mac app targeting the Mac App store or a just a signed, sandboxed DMG or PKG installer, then this won't be suitable.
If I remove the above no-sandbox command from main.js and specify the app sandbox in my entitlements plist as shown below the resulting signed app will not run:
<key>com.apple.security.app-sandbox</key>
<true/>
The app tries to open and just closes. I can try running at the command line with open <appname>.app but this throws the following error in the console:
The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10826 "kLSNoLaunchPermissionErr: User doesn't have permission to launch the app (managed networks)" UserInfo={_LSFunction=_LSLaunchWithRunningboard, _LSLine=2561, NSUnderlyingError=0x7fd3c9c13db0 {Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7fd3c9c158e0 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed with error: 153}}}}}
If I build a signed app with no-sandbox enabled, the app will run just fine on Big Sur using open <appname>.app.
I have tried my best through Google, Stack Overflow, etc to diagnose this but am not getting anywhere. Here's to hoping the Stack Overflow community can provide me the critical clue to solving this.
For further context, I created a new, empty Electron application and followed the Electron Quick Start Guide to the section where it describes creating an empty main.js which technically should allow the Electron app to start -- but it won't. The same error describe above re the GPU gets thrown even without instantiating a BrowserWindow or writing any custom code of my own.
NEW UPDATE: I set these environment variables to true and then tried running the app with npm start:
ELECTRON_ENABLE_LOGGING
ELECTRON_DEBUG_NOTIFICATIONS
ELECTRON_ENABLE_STACK_DUMPING
The result is more detailed error output:
[48836:0823/165857.676747:ERROR:icu_util.cc(179)] icudtl.dat not found in bundle
[48836:0823/165857.676838:ERROR:icu_util.cc(243)] Invalid file descriptor to ICU data received.
[48778:0823/165857.677376:ERROR:gpu_process_host.cc(1003)] GPU process exited unexpectedly: exit_code=5
[48778:0823/165857.677430:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 1 time(s)
[48850:0823/165857.827224:ERROR:icu_util.cc(179)] icudtl.dat not found in bundle
[48848:0823/165857.827255:ERROR:icu_util.cc(179)] icudtl.dat not found in bundle
[48850:0823/165857.827341:ERROR:icu_util.cc(243)] Invalid file descriptor to ICU data received.
[48848:0823/165857.827358:ERROR:icu_util.cc(243)] Invalid file descriptor to ICU data received.
[48778:0823/165857.827836:ERROR:gpu_process_host.cc(1003)] GPU process exited unexpectedly: exit_code=5
[48778:0823/165857.827875:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 2 time(s)
... repeats until the GPU processes crashes 9 times ...
[48778:0823/165903.080134:FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable. Goodbye.
Haven't had time to do the research as to what ICU refers to but thought I would update with this info.
ANOTHER UPDATE: all this has been done on Mac OS Big Sur which is my main development machine. Trying this on a Windows 10 machine, using the same Electron code, dependencies, etc and things work fine. So the problem is either related to Mac OS Big Sur or a specific local issue on my development machine which I cannot identify. Any suggestions on how to diagnose this will be much appreciated.
ONE MORE UPDATE: Based on a guess, I created a new user on my mac, took the code in there and it ran perfectly. So -- this probably means that I need to find something installed in my profile or some corruption in my own profile/settings that is breaking things. As always, any suggestions appreciated it.
In my case, I got this to work using command line switch, --in-process-gpu, or:
app.commandLine.appendSwitch('in-process-gpu');
There's also an extensive list of Chromium switches here that you can try at:
https://peter.sh/experiments/chromium-command-line-switches/
Yeah, the whole hardened runtime thing is just such an awful, awful mess! Now to figure out the next crash!
So -- partial answer. I think I've found the solution to this error:
GPU process isn't usable. Goodbye.
My development directories are all on a file system accessed via a symbolic link. As soon as I moved the folder for this app to my my home directory (no symlinks involved) I could launch with npm start without needing to enable no-sandbox and without seeing this error or the errors related to icudtl.dat.
I haven't yet determined if the problem described with the error below when launching the packaged app is related/solved:
The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10826 "kLSNoLaunchPermissionErr: User doesn't have permission to launch the app (managed networks)" UserInfo={_LSFunction=_LSLaunchWithRunningboard, _LSLine=2561, NSUnderlyingError=0x7fd3c9c13db0 {Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7fd3c9c158e0 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed with error: 153}}}}}
That said, it is a big step forward.
I have a similar issue on a linux machine with an electron app. The answer in this github issue helped me.
Using --disable-gpu-sandbox flag with electron apps solved it for me.
The underlying problem seems to be that the Mac OS sandbox is preventing the GPU process to spawn properly.
You can specify a variety of entitlements when packaging your application, but not all entitlements are created equally, especially entitlements that want access to the keychain, secure enclave and TouchID.
If you're specifying a provisioning profile - make sure that all those entitlements are only in the original file, keep your inherited entitlements empty or to the bare minimum. In my case, I had the keychain-access-groups specified in my inherited entitlements which was a painful lesson to learn. Removing it made the builds not crash!
I believe in your case it's likely that you tried to access files outside of the application itself which might have caused the sandbox to prevent opening the GPU processes.
I know the OP reported this against MacOS, but on my Windows 10 VM I used the following instructions to create the electron-quick-start app…
net use T: \\busdata\company\BrianT
T:
cd \Development\Sandbox\electron
"C:\Users\thomasb\AppData\Local\GitHubDesktop\app-2.9.15\resources\app\git\cmd\git.exe" clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install && npm start
…and then electron wrote error messages to the console, the same errors as those reported by the OP:
[5796:1025/121431.238:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=18
[5796:1025/121431.328:FATAL:gpu_data_manager_impl_private.cc(441)] GPU process isn't usable. Goodbye.
An earlier answer mentioned symbolic links, and to investigate that further I xcopied the entire electron-quick-start folder down from T: (a remapped network folder) to C: (my local disk).
When I then ran npm start in the folder that I'd copied down to C: there was no error.
Looks like electron is being fussy about where the source files live.
I had the same Issue when running the files off of a server such as a nas, but moving files to local storage solved the issue.

How to symbolicate for Xamarin.iOS on Windows

I submitted an iOS app which failed review due to a crash. I was given the crash report which unfortunately for me, was useless because I didn't keep the dSYM files and .app file that I apparently needed to decipher the crash report.
First question -
I've built a new release and I've stored the dSYMs folder away for safe keeping, but I can't find the .app file that I apparently need. this link here suggested that I could change the .ipa file to a zip and then get the .app from unzipping it but there was nothing in the zipped folder once I changed its extension to .zip How to symbolicate crash/error logs from a Xamarin Forms iOS project?
Second question - How do I symbolicate on windows? I've seen guides like this one, but it only shows you how to do it on a MAC. The problem I have is that the project is entirely built on my windows machine which is networked to a MAC. https://jmillerdev.com/symbolicating-ios-crash-files-xamarin-ios/
I was able to symbolicate the crash reports given by apple from the review by using this guide:
https://jmillerdev.com/symbolicating-ios-crash-files-xamarin-ios/
or
How to symbolicate crash/error logs from a Xamarin Forms iOS project?
Basically what you need to do:
Get the .dSYM and .app file from the archived release folder and put it on your MAC in a folder some where. Additionally, put the crash report in the same folder. (The crash report on App Store Connect will be a .txt file. Change it to .crash) Open up the terminal and change the current working directory to that folder I just mentioned. e.g. cd /Applications/crashFolder
Run the following terminal commands
alias symbolicate="/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash -v"
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
Symbolicate your .crash file with this terminal command:
symbolicate -o "symbolicatedCrash1.txt" "crash1.crash" "MyApp.app"

How to generate dsym files near the executable, not outside the bundle, preferably without a post install script?

I'm using LLVM Clang with Xcode and address sanitiser is not creating file:line report. I read the documentation and it says to run dsymutil on the binary before launching the app.
http://clang.llvm.org/docs/AddressSanitizer.html#symbolizing-the-reports
I can achieve that by adding a run script build phase but it is clunky. To do the same with unix-makefiles I figured an install(SCRIPT <script.cmake>) would be better.
Is there a way to avoid all this and have Xcode run dsymutil as part of the build process, probably by a build setting that I don't know about ?
I've tried setting debugging information format to dwarf with dsym, but llvm-symbolizer doesn't use it. I guess that the difference is that dsymutil creates the .dsym file near the executable, inside the bundle :MyExec.dsym. While Xcode creates it outside the bundle: MyExec.app.dsym.
In your Build Settings in Xcode, change the debug format from "DWARF" to "DWARF with dSYM".

Archive fails with error archive Unable to read GoogleService-Info.plist at path Xcode 10.1

It's the first time I go through the process of archiving my app and myy problem is that when I build the projects it builds fine, it runs fine both on simulator than physical iPad, but when I do choose Archive it fails with the error message Command PhaseScriptExecution failed with a nonzero exit code 31merror: Unable to read GoogleService-Info.plist at path.
Following other posts here on SO, I made sure that in Build Phases/Copy Bundle Resources GoogleService-Info.plistis present. I also checked that GoogleService-Info.plist Target Membership is correctly selected.
I tried to delete, throw it into trash and re-add it to the project by drag and drop. I restarted Xcode but nothing solved it.
Any ideas on what else I should have a look at?
Could it be related to my developer's certificate?
As always many thanks.
UPDATE:
I tried uninstalling the pods and reinstalling them but with no changes.
I downloaded again the GoogleService-Info.plistfrom Firebase but also that didn't make a difference.
Update 2:
I deleted the firebase app and recreated one.
Re-downloaded the GoogleService-Info.plistand it's working ok..both on iPad and simulator.
but still archive fails not been able to read the GoogleService-Info.plist..
I'm actually deploying for iOS 9.3 and up..can it have something to do with it?
After a few days of comparing this app with the other one, part of the same bundle, that Archives without a problem, I finally found the problem: A second Fabric script ..that should be used for Answers which was giving me problems and I just put aside using for the moment. I forgot to delete the script for it.
Now that I think about the script could be well be the reason for Answersnot to be working ..time to investigate it ..
Well.. hopefully this will be of help to others..
The incriminated script:
"${PODS_ROOT}/Fabric/upload-symbols" -gsp "${PROJECT_DIR}/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
In my case, the very same error message "Unable to read GoogleService-Info.plist at path [...]" was happening during a simple build, and in my case, that was because my build path had a space in its name like "username/path/to/build/Blabla v0.0/GoogleService-Info.plist".
The executed command in Fabric didn't liked it and was unable to find the file GoogleService-Info.plist.

Symbolicate crash file with dSYM and .ipa file

Is there any concreate way to symbolicate crash logs from my app, i have following things
dSYM file
.ipa Application file
myapp.crash
-
I have tried symbolicatecrash script but it does not work somehow
Xcode does not work also i have Xcode 4.3
I even tried system 'atos' command but it gives me some c or c++ file
I dont have build file in my archive is it because of that, because app was build in different machine ?
This may be too late.. but i saw the method in another link that i am now trying to find :P
Rename your .ipa file to .zip
Open the zip file to extract the app
now run symbolicatecrash script or delete the .symbolicated folder
and restart xcode
if not helpful to you, hope this helps others.
Edit: found the place Symbolicating iPhone App Crash Reports
Aside from xcode's tools, you can use atos: https://stackoverflow.com/a/4954949/312725
Be sure to take slide into account as well: https://stackoverflow.com/a/13576028/312725

Resources