Sometimes the compiler produces .dSYM files. I guess this is a debugging related file, but I don't know what it is, and how to use it.
What is a .dSYM? How do I use it?
dSYM files store the debug symbols for your app
Services like Crashlytics use it to replace the symbols in the crash logs with the appropriate methods names so it will be readable and will make sense.
The benefit of using the dSYM is that you don't need to ship your App with its symbols making it harder to reverse engineer it and also reduce your binary size
In order to use to symbolicate the crash log you need to drag the crash log into the device's device logs in the organizer of the machine that compiled the app binary (a machine that stores the dSYM)
If you have the dSYM but don't have the machine the compiled the app binary follow the instructions in this link in order to install the dSYM into the machine.
There is a mac app that helps you symbolicate a crash log in case you need to do it yourself.
For more information please see apple technical note TN2151
Xcode Debugging Symbols(dSYM)
dSYM it is a Bundle(e.g F49088168M.app.dSYM) which contains a mapping information and with which you can, for example, decode a stack-trace into readable format.
structure:
For example a crash log looks like:
//before
0 libswiftCore.dylib 0x000000018f3c9380 0x18f394000 + 217984
1 libswiftCore.dylib 0x000000018f3c9380 0x18f394000 + 217984
2 libswiftCore.dylib 0x000000018f3c8844 0x18f394000 + 215108
3 libswiftCore.dylib 0x000000018f3a74e0 0x18f394000 + 79072
4 libswiftCore.dylib 0x000000018f3ab0d8 0x18f394000 + 94424
5 F49088168M 0x00000001045ac750 0x104590000 + 116560
6 F49088168M 0x00000001045b7904 0x104590000 + 162052
7 F49088168M 0x00000001045b897c 0x104590000 + 166268
8 F49088168M 0x000000010459d914 0x104590000 + 55572
9 F49088168M 0x00000001045a0e70 0x104590000 + 69232
10 F49088168M 0x00000001045a0f4c 0x104590000 + 69452
dSYM in action
//after Symbolicating(dSYM is used)
0 libswiftCore.dylib 0x000000018f3c9380 closure #1 in closure #1 in closure #1 in _assertionFailure+ 217984 (_:_:file:line:flags:) + 452
1 libswiftCore.dylib 0x000000018f3c9380 closure #1 in closure #1 in closure #1 in _assertionFailure+ 217984 (_:_:file:line:flags:) + 452
2 libswiftCore.dylib 0x000000018f3c8844 _assertionFailure+ 215108 (_:_:file:line:flags:) + 468
3 libswiftCore.dylib 0x000000018f3a74e0 _ArrayBuffer._checkInoutAndNativeTypeCheckedBounds+ 79072 (_:wasNativeTypeChecked:) + 208
4 libswiftCore.dylib 0x000000018f3ab0d8 Array.subscript.getter + 84
5 F49088168M 0x00000001045ac750 static ELM327ResponseManager.getResponse(responseStr:obd2Protocol:) + 116560 (ELM327ResponseManager.swift:27)
6 F49088168M 0x00000001045b7904 ELM327Client.dataInput(_:characteristicUuidStr:) + 162052 (ELM327Client.swift:56)
7 F49088168M 0x00000001045b897c protocol witness for BLEClientInputPort.dataInput(_:characteristicUuidStr:) in conformance ELM327Client + 166268 (<compiler-generated>:0)
8 F49088168M 0x000000010459d914 BLEConnection.peripheralDataReceived(data:characteristicUuidStr:) + 55572 (BLEConnection.swift:124)
9 F49088168M 0x00000001045a0e70 BLEConnection.peripheral(_:didUpdateValueFor:error:) + 69232 (BLEConnection.swift:293)
10 F49088168M 0x00000001045a0f4c #objc BLEConnection.peripheral(_:didUpdateValueFor:error:) + 69452 (<compiler-generated>:0)
By default dSYM is generated by default for a release version.
You can check it:
Build Settings -> Generate Debug Symbols(GCC_GENERATE_DEBUGGING_SYMBOLS) -> Yes
Build Settings -> Debug Information Format(DEBUG_INFORMATION_FORMAT) -> DWARF with dSYM File
The result location you can find in Products folder
To generate dSYM file manually from .app using dsymutil
dsymutil F49088168M.app/F49088168M -o F49088168M.app.dSYM
To symbolicate crash using symbolicatecrash
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/Current/Resources/symbolicatecrash "<path>/F49088168M-2020-06-04-212904.crash" "<path>/F49088168M.app.dSYM" > symbolicated.crash
To open dSYM manually using dwarfdump
dwarfdump --arch arm64 --debug-pubtypes F49088168M.app.dSYM
result looks like:
0x00000065 "PeripheralLogView"
0x000005cc "BLEConnection"
0x000005da "BLEPeripheral"
0x000005e9 "ELM327Client"
*Your .app's dSYM should include all included(framework) dSYMs
[dSYM location]
[.bcsymbolmap]
[Vocabulary]
Related
Ever since Xcode 11 I've not been able to run any apps on my device. They will launch in the simulator just fine. I have an iPhone 11 Max Pro.
I've tried everything I can think of to get it to work and I have no idea what to do at this point. Has anyone figured out a fix ?
I did try setting my project to Legacy build and I still have the same issue.
Here are the details of the failed install to my iPhone.
Details
Unable to install "App Test"
Domain: com.apple.dtdevicekit
Code: -402620395
--
App installation failed
Domain: com.apple.dtdevicekit
Code: -402620395
Failure Reason: A valid provisioning profile for this executable was not found.
User Info: {
DVTRadarComponentKey = 487927;
"com.apple.dtdevicekit.stacktrace" = (
0 DTDeviceKitBase 0x00000001251586e7 DTDKCreateNSError + 109
1 DTDeviceKitBase 0x0000000125158de9 DTDK_AMDErrorToNSError + 792
2 DTDeviceKitBase 0x000000012519856a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 164
3 DVTFoundation 0x000000010b27cc22 DVTInvokeWithStrongOwnership + 73
4 DTDeviceKitBase 0x0000000125198301 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1589
5 IDEiOSSupportCore 0x0000000125020a25 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4523
6 DVTFoundation 0x000000010b3ade8a __DVT_CALLING_CLIENT_BLOCK__ + 7
7 DVTFoundation 0x000000010b3af562 __DVTDispatchAsync_block_invoke + 809
8 libdispatch.dylib 0x00007fff6d6ca583 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x00007fff6d6cb50e _dispatch_client_callout + 8
10 libdispatch.dylib 0x00007fff6d6d0ace _dispatch_lane_serial_drain + 597
11 libdispatch.dylib 0x00007fff6d6d1452 _dispatch_lane_invoke + 363
12 libdispatch.dylib 0x00007fff6d6daa9e _dispatch_workloop_worker_thread + 598
13 libsystem_pthread.dylib 0x00007fff6d9256fc _pthread_wqthread + 290
14 libsystem_pthread.dylib 0x00007fff6d924827 start_wqthread + 15
);
}
--
I faced this issue today and I could not fix it either with the proposed solutions that are out there, because they pointed into the wrong direction.
Do you, by any chance, have frameworks included in your project and set them to "embed without signing"? Changing the included frameworks to "embed & sign" fixed this issue for me.
Not properly re-signing external frameworks seems to cause problems when attempting to install the binary to a real device. The executable mentioned in "A valid provisioning profile for this executable was not found." does in this context refer to the insufficiently signed external framework.
On Xcode 6.3.1 using a multi-project workspace - two Swift frameworks, the app itself, and Cocoapods. I can successfully build and run the app both on the simulator as well as my iPhones, but when I try to Archive it, I get:
Command failed due to signal: Segmentation fault: 11
This error appears to happen on two of my view controller files, but I have no idea what is wrong with them. Tried building from command line. Fruitless. I've also messed with my build settings, as has been suggested in other questions, to no avail.
Has anyone experienced the same issue? Can't submit anything to app store or make a test IPA :( Here is the stack trace produced:
0 swift 0x0000000109d14a18 llvm::sys::PrintStackTrace(__sFILE*) + 40
1 swift 0x0000000109d14ef4 SignalHandler(int) + 452
2 libsystem_platform.dylib 0x00007fff8fbb0f1a _sigtramp + 26
3 libsystem_platform.dylib 000000000000000000 _sigtramp + 1883566336
4 swift 0x00000001097f0d85 (anonymous namespace)::EmitDFDiagnostics::run() + 469
5 swift 0x00000001097fa55e swift::SILPassManager::runFunctionPasses(llvm::ArrayRef<swift::SILFunctionTransform*>) + 1310
6 swift 0x00000001097fb6a7 swift::SILPassManager::runOneIteration() + 2359
7 swift 0x00000001097fbe1c swift::SILPassManager::run() + 1212
8 swift 0x00000001097f8725 swift::runSILDiagnosticPasses(swift::SILModule&) + 597
9 swift 0x00000001095fdd6f frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 4319
10 swift 0x00000001095fcae6 main + 1814
11 libdyld.dylib 0x00007fff8ff895c9 start + 1
I had the exact same problem. I discovered the thing that was keeping the app from successfully archiving was the fact that i used the find() function to find the index of an item in an array. That function is provided by Swift, but when used in my actual codebase it wouldn't archive. I'm assuming there may be a couple stock functions that are preventing archiving. And keep in mind, these functions build and can run on the simulator, but they will not archive.
I am trying to build NPAPI plugin for safari and have been trying to run the simple NPAPI plugin example from https://github.com/mikma/npsimple on Safari on Mac.
The plugin can use npapi library from WEBKIT_DARWIN_SDK or from XULRUNNER_SDK (downloaded from mozilla.org for mac os).
The plugin works as expected by using WEBKIT_DARWIN_SDK but since it conflicts with my other libraries I can't use it. Now the only way left is to use XULRUNNER_SDK but using that results in a crash on NP_Initialize. Since this is the most basic application using NPAPI it is expected to work ( everything is same expect the fact that internal implementation of webkit and xulrunner could be different).
Am I missing something here?
Pasting initial few lines from the log
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 net.webvm 0x00000001004f8228 NP_GetEntryPoints + 24
1 net.webvm 0x00000001004f82b3 NP_Initialize + 67
2 com.apple.WebKit.PluginHost 0x00000001cfb65188 0x1cfb52000 + 78216
3 com.apple.WebKit.PluginHost 0x00000001cfb599e1 0x1cfb52000 + 31201
4 com.apple.WebKit.PluginHost 0x00000001cfb54ad3 0x1cfb52000 + 10963
5 com.apple.CoreFoundation 0x00007fff84fe9a49 __CFRunLoopDoBlocks + 297
6 com.apple.CoreFoundation 0x00007fff84fabe76 __CFRunLoopRun +
You might want to try starting from the npapi-sdk Mac example, which is both simpler than npsimple and more up to date.
For iOS crash reports, it is sufficient to drag and drop the crash report to the Organizer.
Symbolicating iPhone App Crash Reports
But this method doesn't work for Mac OSX crash reports.
How can I symbolicate my Mac OSX crash report ?
Thanks !!
You can use the atos command to get the line number where the app crashed.
Heres a quick guide:
Create a directory for your working files
Open Xcode, select Window->Organizer, goto the Archive tab and find the version of your app that experienced the crash.
Right click on the app archive and select "Show in Finder"
Right click on the .xarchive, select "Show Contents" and find the AppName.dSYM directory and the app and copy them to your working folder
Copy the stack trace to your working folder
Open terminal and change to your working folder. An ls should show YourApp.app YourApp.app.dSYM stacktrace.txt
Open your stack trace in TextEdit. Your going to need to find the Code Type from the header (system architecture - eg. X86-64) and the addresses of the crash. Search through the threads to find the one that crashed (it will say something like "Thread 2 Crashed") then find your objects. You need the two addresses (hex numbers) from that line to get the code line.
Once you've got all the information you need to run the following in the terminal:
atos -o YourApp.app/Contents/MacOS/YourApp -arch x86_64 -l [load-address] [address]
For example, heres an extract from a stacktrace:
Process: MyApp [228]
Path: /Applications/MyApp.app/Contents/MacOS/MyApp
Identifier: uk.co.company.app
Version: 1.0 (1)
App Item ID: 774943227
App External ID: 218062633
Code Type: X86-64 (Native)
Parent Process: launchd [154]
Responsible: MyApp [228]
User ID: 501
Date/Time: 2013-12-17 10:20:45.816 +0100
OS Version: Mac OS X 10.9 (13A603)
Report Version: 11
Anonymous UUID: 7AA662B1-7696-A2C5-AF56-9D4BA2CE9515
Crashed Thread: 2
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
<snip>
Thread 2 Crashed:
0 libsystem_kernel.dylib 0x00007fff8b95a866 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff8bf4f35c pthread_kill + 92
2 libsystem_c.dylib 0x00007fff87571bba abort + 125
3 libsystem_malloc.dylib 0x00007fff897ae093 free + 411
4 uk.co.company.app 0x0000000103580606 0x10356e000 + 75270
5 uk.co.company.app 0x00000001035803da 0x10356e000 + 74714
6 com.apple.Foundation 0x00007fff8d00970b __NSThread__main__ + 1318
7 libsystem_pthread.dylib 0x00007fff8bf4e899 _pthread_body + 138
8 libsystem_pthread.dylib 0x00007fff8bf4e72a _pthread_start + 137
9 libsystem_pthread.dylib 0x00007fff8bf52fc9 thread_start + 13
I can see that the "Code Type" is x86_64, that Thread 2 crashed, and that on line 4 my code was running so we have the addresses we need. Using this information I run the following:
$ atos -o MyApp.app/Contents/MacOS/MyApp -arch x86_64 -l 0x10356e000 0x0000000103580606
This returns:
got symbolicator for MyApp.app/Contents/MacOS/MyApp, base address 100000000
obj_free (in MyApp) (somefile.c:135)
Telling me my app crashed at line 135 of somefile.c
#inkjet 's comment above deserves its own answer.
He built an app that does a full symbolication from your dsym and .crash file.
A free alternative to Sumbolon that I made: bch.us.to/apps/macsymbolicator — It uses atos in the same way described by Rich Able below. – inket Dec 24 '13 at 4:39
putting it all together:
download Mac Symbolicator from here
Open Xcode, select Window->Organizer, goto the Archive tab and find
the version of your app that experienced the crash.
Right click on the app archive and select "Show in Finder"
Right click on the .xarchive, select "Show Contents" and find the
AppName.dSYM directory
Drag your .crash file and AppName.dsym to Sumbolon
Magic happens
this link
this link explains everything to symbolicate the crash log with the line no of crash. you just need to have .dsyms file, .app file and crash log in same folder
i looked around and find nothing better than this. so i am posting it by hoping this will help others.
Should I be able to set breakpoints inside the Cocoa framework itself?
I've been seeing various crashes in my Mac OS X application, sometimes randomly. Here's part of an example call stack from Xcode:
0 - 0x98ed0e20 in __CFRunLoopRun
1 - 0x98ece464 in CFRunLoopRunSpecific
2 - 0x98ece291 in CFRunLoopRunInMode
3 - 0x96a90004 in RunCurrentEventLoopInMode
4 - 0x96a8fdbb in ReceiveNextEventCommon
5 - 0x96a8fc40 in BlockUntilNextEventMatchingListInMode
6 - 0x925b078d in _DPSNextEvent
7 - 0x925affce in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
8 - 0x92572247 in -[NSApplication run]
9 - 0x021f009c in QEventDispatcherMac::processEvents at qeventdispatcher_mac.mm:591
10 - 0x01e47742 in QEventLoop::processEvents at qeventloop.cpp:149
11 - 0x01e4799e in QEventLoop::exec at qeventloop.cpp:201
12 - 0x01e49a33 in QCoreApplication::exec at qcoreapplication.cpp:1003
13 - 0x02254c54 in QApplication::exec at qapplication.cpp:3581
When I click on lines 0 - 8, Xcode displays disassembly.
I've changed my Xcode project so that it uses the _debug suffix when loading frameworks. This allows me to step through the Qt code in lines 9 - 13, but line 8 is called at startup and crashes can happen at any time after that.
If I can't set breakpoints, are there any tools that might help me debug problems like this?
Thanks in advance.
You can set up a breakpoint so it breaks on code outside your own. But you will not be able to see the source because you don't have the source code.
In xCode (3.x.x)
"Run->Manage Breakpoints->Add Symbolic Breakpoint"
In XCode 4 you can create a symbolic breakpoint with
Product->Debug->Create Symbolic Breakpoint...
In XCode 5
Debug->Breakpoints->Create Symbolic Breakpoint