IT story

충돌 로그 Xcode를 상징화하는 방법?

hot-time 2020. 5. 23. 09:03
반응형

충돌 로그 Xcode를 상징화하는 방법?


Xcode 5 Organizer에는 모든 충돌 로그를 나열하는보기가 있습니다. 드롭 크래시 로그를 여기로 드래그 할 수 있습니다. 그러나 Xcode 6부터는 장치를 구성에서 벗어나 새 창을 가지고 있음을 알고 있습니다. 그러나 Xcode 6으로 업그레이드 한 후 Xcode 5에서 드래그 다운 된 충돌 로그를 볼 수있는 곳을 찾지 못했습니다.


Ok 나는 당신이 이것을 할 수 있다는 것을 깨달았습니다.

  1. Xcode > Window > Devices연결된 아이폰 / 아이 패드 선택 / 등 상단 왼쪽.
  2. 장치 로그보기
  3. 모든 로그

아마도 거기에 많은 로그가 있고 나중에 가져온 로그를 쉽게 찾을 수 있도록하기 위해이 시점에서 모든 로그를 삭제할 수 있습니다. 또는 충돌이 발생한 정확한 시점을 모른다면 어쨌든 파일에 기록해야합니다 ... 게으 르기 때문에 오래된 로그를 모두 삭제합니다 (실제로 시간이 걸렸습니다).

  1. 파일을 해당 목록으로 끌어다 놓기 만하면됩니다. 그것은 나를 위해 일했다.

이 답변을 나 자신만큼이나 커뮤니티에 쓰십시오.

충돌 보고서를 상징하는 데 문제가있는 경우 다음과 같이이를 극복 할 수 있습니다.

  1. 복사, 별도의 폴더를 생성 Foo.app하고 Foo.app.dSYM해당에서 .xcarchive폴더로. 또한 .crash보고서를 폴더에 복사하십시오 .

  2. TextEdit 또는 다른 곳에서 충돌 보고서를 열고 Binary Images:섹션으로 이동 하여 첫 번째 주소를 복사하십시오 (예 :) 0xd7000.

  3. cd폴더에. 이제 다음 명령을 실행할 수 있습니다.

    xcrun atos -o Foo.app/Foo -arch arm64 -l 0xd7000 0x0033f9bb

이것은 address의 심볼을 상징합니다 0x0033f9bb. -arch옵션 의 올바른 값을 선택하십시오 ( Binary Images:섹션 의 첫 번째 라인에서 가져 오거나 Hardware Model:충돌 보고서 및 앱의 지원되는 아치에서 알아낼 수 있음 ).

충돌 보고서의 필요한 주소 (예 : 스레드 호출 스택)를 텍스트 파일 (TextEdit에서 Option을 누른 상태에서 필요한 텍스트 블록을 선택하거나 복사 및 잘라 내기)에 직접 복사하여 다음과 같은 결과를 얻을 수 있습니다.

0x000f12fb
0x002726b7
0x0026d415
0x001f933b
0x001f86d3

이제이를 텍스트 파일 (예 :)로 저장 addr.txt하고 다음 명령을 실행할 수 있습니다.

xcrun atos -o Foo.app/Foo -arch arm64 -l 0xd7000 -f addr.txt

이것은 한 번에 모든 주소에 대해 좋은 상징을 줄 것입니다.

추신

위의 작업을 수행하기 전에 모든 것이 올바르게 설정되었는지 확인하는 것이 atos좋습니다 (기본적으로 제공된 모든 주소에 대해 행복하게보고 할 것입니다).

확인을 수행하려면 충돌 보고서를 열고에 대한 호출 스택 끝으로 이동하십시오 Thread 0. 끝에서 첫 번째 줄로 앱을 나열합니다 (보통 두 번째 줄). 예 :

34  Foo                    0x0033f9bb 0xd7000 + 2525627

main()전화 해야합니다 . 0x0033f9bb위에서 설명한 것처럼 주소 ( 이 경우)를 상징하면 이것이 main()임의의 방법이나 기능 이 아니라는 것을 확인해야 합니다.

주소가 주소가 아닌 경우 main()로드 주소 ( -l옵션) 및 아치 ( -arch옵션)를 확인하십시오.

PPS

위에서로 인해 일을하지 않는 경우 비트 코드 ,의 dSYM (찾기> 패키지 내용보기)에서 실행 가능한 바이너리를 추출, 아이튠즈 커넥트에서 빌드의 dSYM를 다운로드 디렉토리에 복사하고 (즉 사용 Foo은 AS) atos대신 에을 (를 ) 인수 하십시오 Foo.app/Foo.


당신도 이것을 참조 할 수 있습니다, 나는 수동 충돌 다시 상징 의 단계별 절차를 작성했습니다 .

충돌 재 기호

1 단계

위의 모든 파일 (MyApp.app, MyApp-dSYM.dSYM 및 MyApp-Crash-log.crash)을 터미널을 쉽게 사용할 수있는 편리한 이름의 폴더로 이동하십시오.

나에게있어 데스크탑은 가장 쉽게 접근 할 수있는 곳이다.) 따라서이 세 파일을 데스크탑의 MyApp 폴더로 옮겼습니다.

2 단계

이제 Finder가 바뀌 었습니다. XCODE 버전에 해당되는 경로를 찾으십시오.

이 명령을 사용하여 symbolicatecrash스크립트 파일 을 찾으십시오 .
find /Applications/Xcode.app -name symbolicatecrash

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

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

XCode 7 /Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash

Xcode 6 /Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources

Xcode 6 이하 Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Versions/A/Resources

또는 Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources

3 단계

찾은 symbolicatecrash 스크립트 파일의 디렉토리를 $PATH다음 sudo vim /etc/paths.d/Xcode-symbolicatecrash같이 env 변수에 추가하고 스크립트 파일의 디렉토리를 붙여넣고 파일을 저장하십시오. 새 터미널을 열 때에있는 symbolicatecrash명령으로 모든 폴더를 호출 할 수 있습니다 /usr/bin.

또는

이 위치에서 symbolicatecrash 파일을 복사하여 Desktop / MyApp에 붙여 넣습니다 (잠깐만 ... 맹목적으로 따르지 마십시오. Sybolicatecrash 파일을 MyApp 폴더에 붙여넣고 있습니다. 하나는 좋아하는 위치에서 1 단계에서 생성 한 파일 중 하나입니다. )

4 단계

터미널을 열고 CD를 MyApp 폴더로 엽니 다.

cd Desktop/MyApp — Press Enter
export DEVELOPER_DIR=$(xcode-select --print-path)

 —  Enter를 누르십시오

./symbolicatecrash -v MyApp-Crash-log.crash MyApp.dSYM

 —  Enter를 누르십시오

That’s it !! Symbolicated logs are on your terminal… now what are you waiting for? Now simply, Find out the Error and resolve it ;)

Happy Coding !!!


For me the .crash file was enough. Without .dSYM file and .app file.

I ran these two commands on the mac where I build the archive and it worked:

export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer" 

/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash  /yourPath/crash1.crash > /yourPath/crash1_symbolicated.crash

There is an easier way using Xcode (without using command line tools and looking up addresses one at a time)

  1. Take any .xcarchive file. If you have one from before you can use that. If you don't have one, create one by running the Product > Archive from Xcode.

  2. Right click on the .xcarchive file and select 'Show Package Contents'

  3. Copy the dsym file (of the version of the app that crashed) to the dSYMs folder

  4. Copy the .app file (of the version of the app that crashed) to the Products > Applications folder

  5. Edit the Info.plist and edit the CFBundleShortVersionString and CFBundleVersion under the ApplicationProperties dictionary. This will help you identify the archive later

  6. Double click the .xcarchive to import it to Xcode. It should open Organizer.

  7. Go back to the crash log (in Devices window in Xcode)

  8. Drag your .crash file there (if not already present)

  9. The entire crash log should now be symbolicated. If not, then right click and select 'Re-symbolicate crash log'


Follow these steps in Xcode 10 to symbolicate a crash log from an app build on the same machine:

  1. Inside Organizer, locate the archive where the app is based on.
  2. Click on the Download Debug Symbols button. Nothing will appear in your Downloads folder, but that's OK.
  3. Connect the build machine to an iOS device.
  4. Select the device in Devices and Simulators.
  5. Click on the View Devices Logs button.
  6. Drag-and-drop the crash file to the left panel. The file must end with a .crash extension, otherwise the drag fails.
  7. Switch to the All Logs tab.
  8. Select the added crash file.
  9. The file should automatically symbolicate, otherwise use the right-click context menu item Re-Symbolicate Log.

If you have the .dSYM and the .crash file in the same sub-folder, these are the steps you can take:

  1. Looking at the backtrace in the .crash file, note the name of the binary image in the second column, and the address in the third column (e.g. 0x00000001000effdc in the example below).
  2. Just under the backtrace, in the "Binary Images" section, note the image name, the architecture (e.g. arm64) and load address (0x1000e4000 in the example below) of the binary image (e.g. TheElements).
  3. Execute the following:

$ atos -arch arm64 -o TheElements.app.dSYM/Contents/Resources/DWARF/TheElements -l 0x1000e4000 0x00000001000effdc -[AtomicElementViewController myTransitionDidStop:finished:context:]

Authoritative source: https://developer.apple.com/library/content/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-SYMBOLICATE_WITH_ATOS


Make sure that your Xcode application name doesn't contain any spaces. This was the reason it didn't work for me. So /Applications/Xcode.app works, while /Applications/Xcode 6.1.1.app doesn't work.


From Apple's docs:

Symbolicating Crash Reports With Xcode Xcode will automatically attempt to symbolicate all crash reports that it encounters. All you need to do for symbolication is to add the crash report to the Xcode Organizer.

  • Connect an iOS device to your Mac
  • Choose "Devices" from the "Window" menu
  • Under the "DEVICES" section in the left column, choose a device
  • Click the "View Device Logs" button under the "Device Information" section on the right hand panel
  • Drag your crash report onto the left column of the presented panel
  • Xcode will automatically symbolicate the crash report and display the results To symbolicate a crash report, Xcode needs to be able to locate the following:

    1. The crashing application's binary and dSYM file.

    2. The binaries and dSYM files for all custom frameworks that the application links against. For frameworks that were built from source with the application, their dSYM files are copied into the archive alongside the application's dSYM file. For frameworks that were built by a third-party, you will need to ask the author for the dSYM file.

    3. Symbols for the OS that the that application was running on when it crashed. These symbols contain debug information for the frameworks included in a specific OS release (e.g, iOS 9.3.3). OS symbols are architecture specific - a release of iOS for 64-bit devices won't include armv7 symbols. Xcode will automatically copy OS symbols from each device that you connect to your Mac.

If any of these are missing Xcode may not be able to symbolicate the crash report, or may only partially symbolicate the crash report.


The easiest process to symbolicate crash logs:

  1. preserve the xcarchive file from the organizer during IPA building process for future use.
  2. When the crash occurs, collect the crash logs from affected device. The extension should be .crash. If the crash log is in .ips format, just rename it to .crash.
  3. Double click the xcarchive from the stored path to make it appear in organizer(if not present already).
  4. open in xcode window->devices and simulators -> view device logs -> all logs -> drag and drop the .crash file.

Wait for 5secs. Bang! the application calls in stack trace will be symbolicated! You may still see a lot of symbols though! those are internal library and framework calls.

This is the easiest one, tried and tested!

참고URL : https://stackoverflow.com/questions/25855389/how-to-symbolicate-crash-log-xcode

반응형