Iphone 应用程序崩溃报告的象征

I'm looking to try and symbolicate my iPhone app's crash reports.

I retrieved the crash reports from iTunes Connect. I have the application binary that I submitted to the App Store and I have the dSYM file that was generated as part of the build.

I have all of these files together inside a single directory that is indexed by spotlight.

What now?

I have tried invoking:

symbolicatecrash crashreport.crash myApp.app.dSYM

and it just outputs the same text that is in the crash report to start with, not symbolicated.

Am I doing something wrong?

转载于:https://stackoverflow.com/questions/1460892/symbolicating-iphone-app-crash-reports

csdnceshi58
Didn"t forge You can refer this : medium.com/@Mrugraj/crash-re-symbolication-5c28d3a3a883
5 年多之前 回复
csdnceshi65
larry*wei Here's a very simple open source app for OS X that lets you simply drag a crash log and the corresponding .xcarchive (including dSYM) to symbolicate it: github.com/johnno1962/Symbolicate
大约 6 年之前 回复
csdnceshi67
bug^君 If anyone is wondering where can you get *.app, *.dSYM & crash logs to being with then look at my answer below.
6 年多之前 回复
csdnceshi64
游.程 I've created a script which may help: github.com/amleszk/scripts/blob/master/…
大约 8 年之前 回复
csdnceshi53
Lotus@ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash
8 年多之前 回复
csdnceshi76
斗士狗 You can also see my answer at iPhone SDK : Where is symbolicatecrash.sh located?. I list out where to find the symbolicatecrash command, how to use it, and how to find the dSYM file needed to do symbolication.
接近 9 年之前 回复

22个回答

After reading all these answers here in order to symbolicate a crash log (and finally succeeding) I think there are some points missing here that are really important in order to determine why the invocation of symbolicatecrash does not produce a symbolicated output.

There are 3 assets that have to fit together when symbolicating a crash log:

  1. The crash log file itself (i.e. example.crash), either exported from XCode's organizer or received from iTunes Connect.
  2. The .app package (i.e. example.app) that itself contains the app binary belonging to the crash log. If you have an .ipa package (i.e. example.ipa) then you can extract the .app package by unzipping the .ipa package (i.e. unzip example.ipa). Afterwards the .app package resides in the extracted Payload/ folder.
  3. The .dSYM package containing the debug symbols (i.e. example.app.dSYM)

Before starting symbolication you should check if all those artifacts match, which means that the crash log belongs to the binary you have and that the debug symbols are the ones produced during the build of that binary.

Each binary is referred by a UUID that can be seen in the crash log file:

...
Binary Images:
0xe1000 -    0x1f0fff +example armv7  <aa5e633efda8346cab92b01320043dc3> /var/mobile/Applications/9FB5D11F-42C0-42CA-A336-4B99FF97708F/example.app/example
0x2febf000 - 0x2fedffff  dyld armv7s  <4047d926f58e36b98da92ab7a93a8aaf> /usr/lib/dyld
...

In this extract the crash log belongs to an app binary image named example.app/example with UUID aa5e633efda8346cab92b01320043dc3.

You can check the UUID of the binary package you have with dwarfdump:

dwarfdump --uuid example.app/example
UUID: AA5E633E-FDA8-346C-AB92-B01320043DC3 (armv7) example.app/example

Afterwards you should check if the debug symbols you have also belong to that binary:

dwarfdump --uuid example.app.dSYM
UUID: AA5E633E-FDA8-346C-AB92-B01320043DC3 (armv7) example.app.dSYM/Contents/Resources/DWARF/example

In this example all assets fit together and you should be able to symbolicate your stacktrace.

Proceeding to the symbolicatecrash script:

In Xcode 8.3 you should be able to invoke the script via

/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash -v example.crash 2> symbolicate.log

If it is not there you may run a find . -name symbolicatecrash in your Xcode.app directory to find it.

As you can see there are no more parameters given. So the script has to find your application binary and debug symbols by running a spotlight search. It searches the debug symbols with a specific index called com_apple_xcode_dsym_uuids. You can do this search yourself:

mdfind 'com_apple_xcode_dsym_uuids = *'

resp.

mdfind "com_apple_xcode_dsym_uuids == AA5E633E-FDA8-346C-AB92-B01320043DC3"

The first spotlight invocation gives you all indexed dSYM packages and the second one gives you the .dSYM packages with a specific UUID. If spotlight does not find your .dSYM package then symbolicatecrash will neither. If you do all this stuff e.g. in a subfolder of your ~/Desktop spotlight should be able to find everything.

If symbolicatecrash finds your .dSYM package there should be a line like the following in symbolicate.log:

@dsym_paths = ( <SOME_PATH>/example.app.dSYM/Contents/Resources/DWARF/example )

For finding your .app package a spotlight search like the following is invoked by symbolicatecrash:

mdfind "kMDItemContentType == com.apple.application-bundle && (kMDItemAlternateNames == 'example.app' || kMDItemDisplayName == 'example' || kMDItemDisplayName == 'example.app')"

If symbolicatecrash finds your .app package there should be the following extract in symbolicate.log:

Number of symbols in <SOME_PATH>/example.app/example: 2209 + 19675 = 21884
Found executable <SOME_PATH>/example.app/example
-- MATCH

If all those resources are found by symbolicatecrash it should print out the symbolicated version of your crash log.

If not you can pass in your dSYM and .app files directly.

symbolicatecrash -v --dsym <SOME_PATH>/<App_URI>.app.dSYM/<APP_NAME>.app.dsym <CRASHFILE> <SOME_OTHER_PATH>/<APP_NAME>.app/<APP_NAME> > symbolicate.log

Note: The symbolicated backtrace will be output to terminal, not symbolicate.log.

csdnceshi65
larry*wei Regarding his step "You can check the UUID of the binary package you have with dwarfdump:" If your app has a space in name then your dwarfdump would look like this: "$ dwarfdump --uuid 'Your Appname.app'/Your_Appname" In the second part it replaces the space with an underscore.
2 年多之前 回复
csdnceshi70
笑故挽风 I can't, for the life of me, seem to get this to work...my .app and .dSYM file are in the same directory, from which I'm running 'symbolicatecrash', but the output (both to terminal and log file) is simply blank. Anyone encountered this? I also tried specifying the app and .dsym manually, same result.
接近 3 年之前 回复
csdnceshi73
喵-见缝插针 symbolicate crash also has several helpful options. <SYMBOL_PATH> Additional search paths in which to search for symbol rich binaries -o | --output <OUTPUT_FILE> The symbolicated log will be written to OUTPUT_FILE. Defaults to "-" (i.e. stdout) if not specified -d | --dsym <DSYM_BUNDLE> Adds additional dSYM that will be consulted if and when a binary's UUID matches (may be specified more than once)
接近 4 年之前 回复
csdnceshi55
~Onlooker Note that for Xcode 5, this has moved to: <PATH_TO_Xcode.app>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Versions/Current/Resources/symbolicatecrash
接近 7 年之前 回复
weixin_41568134
MAO-EYE This is the best answer
接近 7 年之前 回复
csdnceshi76
斗士狗 There is an app in appstore that I found, that helps to find and symbolicate crash logs. itunes.apple.com/us/app/symbolicator/id705354958?ls=1&mt=12
大约 7 年之前 回复
csdnceshi55
~Onlooker This is a great explanation and should be the top answer IMO, thank you. Note that you may have to set your DEVELOPER_DIR environment variable if the script complains about it like so: export DEVELOPER_DIR=xcode-select --print-path . I added this line to my ~/.bash_profile. See stackoverflow.com/q/11682789/350761
大约 7 年之前 回复
weixin_41568196
撒拉嘿哟木头 This was really helpful! In my case the .app file has different name than the executable name (I do not know why but it is built this way by Xcode). After renaming .app file in the XCode archive, the symbolicating did work.
大约 7 年之前 回复
csdnceshi71
Memor.の This is a more complete answer. IMHO should get more upvotes.
7 年多之前 回复
csdnceshi62
csdnceshi62 i can find all the files however i get this, and no symbolicated output No crash report version in testlog.crash at /usr/bin/symbolicatecrash line 921.
7 年多之前 回复

With the latest version of Xcode (3.2.2), you can drag and drop any crash reports into the Device Logs section of the Xcode Organiser and they will automatically by symbolicated for you. I think this works best if you built that version of the App using Build & Archive (also part of Xcode 3.2.2)

weixin_41568184
叼花硬汉 This doesn't work with iTunes Connect which is asked in the question.
接近 4 年之前 回复
csdnceshi80
胖鸭 For people that have the same problem as @Altaveron - Symbolicating a crash log requires the system files from a similar device running the same system version as the crash log. Check the iOS version (e.g. 7.1.2 (11D257)) from which the crash log comes, and plug in a device in Xcode that has that same version, so Xcode can extract the symbols. You can check if you have the correct symbols in ~/Library/Developer/Xcode/iOS DeviceSupport/
大约 6 年之前 回复
csdnceshi70
笑故挽风 Works great with XCode 5.1 This is much simpler than using the terminal.
6 年多之前 回复
csdnceshi66
必承其重 | 欲带皇冠 Don't work for me with downloaded crash reports from iTunes Connect.
大约 7 年之前 回复
weixin_41568126
乱世@小熊 Make sure the first line in your crash report is... Incident Identifier: 12345 (where 12345 is a random string of numbers) otherwise XCode wont let you import it. I was using CrashReporter.framework and it was generating the first line as Incident Identifier: [TODO] and that was causing XCode to reject it
7 年多之前 回复
csdnceshi64
游.程 This didn't work from me when I imported an archive file from another computer to get a crash log. :( For this reason I had to manually symbolicate the file. You can find steps on how to do the symbolication here: iPhone SDK : Where is symbolicatecrash.sh located?
接近 9 年之前 回复
csdnceshi74
7*4 This tip works with Xcode 4.2. Place crashlogs in Device Logs of Organizer. Restart the Organizer will get symbolicated crash logs !!! Thanks.
接近 9 年之前 回复
csdnceshi63
elliott.david I had some partial success with that script; it failed on approx 50% of the Apple library calls though, reported lots of errors along the lines of "armv7 architecture not found". With Xcode 3.x, I'd get symbolication on 99% of calls.
9 年多之前 回复
csdnceshi72
谁还没个明天 I'm not sure if this solves the same problem you have, but someone has patched the symbolicate script github.com/nskboy/symbolicatecrash-fix YMMV :)
9 年多之前 回复
csdnceshi63
elliott.david This is simply not working with Xcode4, on a fresh install. Seems to be a new bug :(
9 年多之前 回复

I use Airbrake in my apps, which does a fairly good job of remote error logging.

Here's how I symbolicate them with atos if the backtrace needs it:

  1. In Xcode (4.2) go to the organizer, right click on the archive from which the .ipa file was generated.

  2. In Terminal, cd into the xcarchive for instance MyCoolApp 10-27-11 1.30 PM.xcarchive

  3. Enter the following atos -arch armv7 -o 'MyCoolApp.app'/'MyCoolApp' (don't forget the single quotes)

  4. I don't include my symbol in that call. What you get is a block cursor on an empty line.

  5. Then I copy/paste my symbol code at that block cursor and press enter. You'll see something like:

    -[MyCoolVC dealloc] (in MyCoolApp) (MyCoolVC.m:34)

  6. You're back to a block cursor and you can paste in other symbols.

Being able to go through your backtrace one item without re-entering the first bit is a nice time saver.

Enjoy!

Steps to symbolicate a crash report automatically using XCode:

UPDATED FOR XCODE 9

  1. Connect any iOS device to your Mac (yes a physical one, yes I know this is stupid)

  2. Choose "Devices" from the "Window" menu enter image description here

  3. Click your device on the left and VIEW DEVICE LOGS on the right enter image description here

  4. Wait. It might take a minute to show up. Maybe doing Command-A then Delete will speed this up.

  5. Critical undocumented step: rename the crash report that you got from iTunesConnect from .txt extension to .crash extension

  6. Drag the crash report into that area on the left enter image description here

And then Xcode will symbolicate the crash report and display the results.

Source: https://developer.apple.com/library/ios/technotes/tn2151/_index.html

csdnceshi75
衫裤跑路 Helped me to see the crash, and images are big plus to see. Thanks.
2 年多之前 回复
weixin_41568208
北城已荒凉 Thank you for the feedback, I will make this bold
接近 3 年之前 回复
csdnceshi80
胖鸭 Thank you! None of the other answers actually say that the device you use does not need to be the device (or even device type) that the crash occurred on.
接近 3 年之前 回复
csdnceshi76
斗士狗 This deserves a lot more votes :)
3 年多之前 回复
weixin_41568208
北城已荒凉 Thank you, I'm adding pictures now. Also included the SUPER UNDOCUMENTED step. I thought about make a git of red text and splicing it in there so that it would really stand out. Then I stopped thinking about that.
接近 4 年之前 回复
csdnceshi79
python小菜 This is the official Apple procedure. Should be the answer.
大约 4 年之前 回复

The combination that worked for me was:

  1. Copy the dSYM file into the directory where the crash report was
  2. Unzip the ipa file containing the app ('unzip MyApp.ipa')
  3. Copy the application binary from the resulting exploded payload into the same folder as the crash report and symbol file (Something like "MyApp.app/MyApp")
  4. Import or Re-symbolicate the crash report from within XCode's organizer

Using atos I wasn't able to resolve the correct symbol information with the addresses and offsets that were in the crash report. When I did this, I see something more meaningful, and it seems to be a legitimate stack trace.

For those using Airbrake, there's a solid response above but it wouldn't work for me without tweaking:

Works for some memory addresses but not others, not sure why...

  • Create new dir on desktop or wherever
  • Find archive in question in Xcode organizer
  • Double tap to reveal in finder
  • Double tap to show bundle contents
  • Copy .dSYM file and .app file into new dir
  • cd into new dir
  • Run this command: atos -arch armv7 -o 'Vimeo.app'/'Vimeo'
  • Terminal will enter an interactive move
  • Paste in memory address and hit enter, it will output method name and line number
  • Alternatively, enter this command: atos -arch armv7 -o 'Vimeo.app'/'Vimeo' To get info for one address only

Just a simple and updated answer for xcode 6.1.1 .

STEPS

1.Xcode>Window>Devices.

2.Select a device from a list of devices under DEVICES section.

3.Select View Device Logs.

4.Under the All Logs section you can directly drag drop the report.crash

5.Xcode will automatically Symbolicate the crash report for you.

6.You can find the Symbolicated crash report by matching its Date/Time with the Date/Time mentioned in your crash report.

csdnceshi55
~Onlooker How do we do this if the crash came from Apple/ iTunesConnect? So in other words we don't actually know or have the device that the crash occurred on?
接近 3 年之前 回复
csdnceshi63
elliott.david This is the official Apple procedure. Should be the answer. Apple link: Technical Note TN2151: Understanding and Analyzing iOS Application Crash Reports
大约 4 年之前 回复
csdnceshi61
derek5. Crash reports which I have downloaded from Apple Resolution Center usually have extension of .txt. Remember to rename them to .crash, otherwise Device Logs may refuse to add them. Work well for my current XCode 6.3.1
5 年多之前 回复

In XCode 4.2.1, open Organizer, then go to Library/Device Logs and drag your .crash file into the list of crash logs. It will be symbolicated for you after a few seconds. Note that you must use the same instance of XCode that the original build was archived on (i.e. the archive for your build must exist in Organizer).

csdnceshi77
狐狸.fox It worked!!!!!!!
6 年多之前 回复

The Magical XCode Organizer isn't that magical about symbolicating my app. I got no symbols at all for the crash reports that I got back from Apple from a failed app submission.

I tried using the command-line, putting the crash report in the same folder as the .app file (that I submitted to the store) and the .dSYM file:

$ symbolicatecrash "My App_date_blahblah-iPhone.crash" "My App.app"

This only provided symbols for my app and not the core foundation code, but it was better than the number dump that Organizer is giving me and was enough for me to find and fix the crash that my app had. If anyone knows how to extend this to get Foundation symbols it would be appreciated.

I also put dsym, app bundle, and crash log together in the same directory before running symbolicate crash

Then I use this function defined in my .profile to simplify running symbolicatecrash:

function desym
{
    /Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash -A -v $1 | more
}

The arguments added there may help you.

You can check to make sure spotlight "sees" your dysm files by running the command:

mdfind 'com_apple_xcode_dsym_uuids = *'

Look for the dsym you have in your directory.

NOTE: As of the latest Xcode, there is no longer a Developer directory. You can find this utility here:

/Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Vers‌​ions/A/Resources/symbolicatecrash

weixin_41568208
北城已荒凉 Thanks, will update answer
大约 5 年之前 回复
csdnceshi63
elliott.david Since Xcode 6, symbolicatecrash is located here : /Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash
大约 5 年之前 回复
csdnceshi54
hurriedly% This did not directly work. But this did: stackoverflow.com/questions/7675863/…
8 年多之前 回复
csdnceshi55
~Onlooker That just hangs for me...
8 年多之前 回复
weixin_41568127
?yb? And I did all that, and still not working!
接近 11 年之前 回复
weixin_41568127
?yb? Oops, apparently there is another SO question for that stackoverflow.com/questions/1859852/…
接近 11 年之前 回复
weixin_41568127
?yb? Meaning "Can't exec "/usr/bin/xcode-select": No such file or directory at /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneRemoteDevice.xcodeplugin/Contents/Resources/symbolicatecrash line 49."
接近 11 年之前 回复
weixin_41568127
?yb? How about "Use of uninitialized value $devToolsPath"
接近 11 年之前 回复
weixin_41568208
北城已荒凉 Also, try adding "." after the command, so it would be "symbolicatecrash -A -v MyApp.crashlog ." . That forces it to look in the current directory if it's not doing so already.
大约 11 年之前 回复
weixin_41568208
北城已荒凉 The script should produce some warning text at the beginning if it cannot find the dsym - can you look for that and see what it says?
大约 11 年之前 回复
csdnceshi68
local-host I looked at the mdfind output, and the dSYM file can definitely be seen by spotlight. However, the symbolicatecrash script still doesn't output anything different from the crash report itself. Even using the arguments you provided.
大约 11 年之前 回复
共22条数据 1 3 尾页
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐