Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Instruments - How to load dSYM file for Swift libraries such as libswift.foundation.dylib?

I'm trying to profile a Swift application in Instruments and am having difficulty because debug symbols for libswiftCore.dylib and libswiftFoundation.dylib libraries are not being displayed. The mouseover text suggests using File -> Symbols to manually select the dSYM files but I have no idea where they are stored, or even if they exist. Symbols from code that I've written are appearing fine.

I set up a test project and profiled it in instruments to demonstrate:

Symbols from libSwiftCore.dylib are not available

How can I identify the functions shown from libswiftCore.dylib?

like image 911
rankAmateur Avatar asked Jan 08 '15 12:01

rankAmateur


People also ask

How do I install dSYM?

Upload the dSYM File to AppDynamics Using the UIFrom the Mobile App menu, click Configuration. Click Mobile App Configuration >. From dSYM Mappings, click Upload dSYM package file for iOS crashes. From the XCode dSYM package upload dialog, click Choose File.


2 Answers

This answer is copied from https://github.com/Flash3001/iOSCharts.Xamarin/issues/17

by: Flash3001

but hope this will help you:

The file is located in: /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS

Before:

<Target Name="_CalculateCodesignAppBundleInputs" Condition="'$(_RequireCodeSigning)' == 'true'">         <ItemGroup>             <_CodesignAppBundleInput Include="$(_NativeExecutable)" />             <_CodesignAppBundleInput Include="$(_AppBundlePath)Info.plist" />             <_CodesignAppBundleInput Include="$(_AppBundlePath)embedded.mobileprovision" />             <_CodesignAppBundleInput Include="$(DeviceSpecificIntermediateOutputPath)Entitlements.xcent" />             <_CodesignAppBundleInput Include="@(_BundleResourceWithLogicalName)" />             <_CodesignAppBundleInput Include="@(_NativeLibrary)" />             <_CodesignAppBundleInput Include="@(_Frameworks)" />             <_CodesignAppBundleInput Include="@(_ResolvedAppExtensionReferences -> '$(_AppBundlePath)PlugIns\%(FileName)%(Extension)\_CodeSignature\CodeResources')" Condition="'$(IsAppExtension)' == 'false'" />              <!-- Include WatchOS1 App references -->             <_CodesignAppBundleInput Include="@(_ResolvedWatchAppReferences -> '$(_AppBundlePath)%(FileName)%(Extension)\_CodeSignature\CodeResources')" Condition="'$(IsAppExtension)' == 'true'" />              <!-- Include WatchOS2 App references -->             <_CodesignAppBundleInput Include="@(_ResolvedWatchAppReferences -> '$(_AppBundlePath)Watch\%(FileName)%(Extension)\_CodeSignature\CodeResources')" Condition="'$(OutputType)' == 'Exe'" />         </ItemGroup>     </Target>      <Target Name="_CodesignAppBundle" Condition="'$(_RequireCodeSigning)' == 'true'" DependsOnTargets="$(_CodesignAppBundleDependsOn)"         Inputs="@(_CodesignAppBundleInput)"         Outputs="$(DeviceSpecificIntermediateOutputPath)codesign\$(_AppBundleName)$(AppBundleExtension)"> 

After:

<Target Name="_CalculateCodesignAppBundleInputs" Condition="'$(_RequireCodeSigning)' == 'true'">         <ItemGroup>             <_CodesignAppBundleInputs Include="$(_AppBundlePath)**\*.*" Exclude="$(_AppBundlePath)_CodeSignature\CodeResources" />         </ItemGroup>     </Target>      <Target Name="_CodesignAppBundle" Condition="'$(_RequireCodeSigning)' == 'true'" DependsOnTargets="$(_CodesignAppBundleDependsOn)"         Inputs="@(_CodesignAppBundleInputs)" Outputs="$(_AppBundlePath)_CodeSignature\CodeResources"> 

Warning: Do not copy the entire file, as it will break other things. Warning 2: You should not normally modify this file, as it is Xamarin's and can stop the build process from working if you do the wrong thing. Warning 3: It will be replaced when you update Xamarin.

like image 158
hood Avatar answered Sep 20 '22 06:09

hood


If you have installed Xcode in the default location, the swift dylib files can be found in:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/

(Please note, these are not dSYM files) Under this directory you will find a subdirectory for the different build targets, for example, macosx for OS X, iphoneos for iOS devices and iphonesimulator for the simulator etc. (browse to the lib folder to view what's there)

Loading the correct file from one of these folders should hopefully work.

If all else fails you may need to build your own copy of the swift libraries with debug symbols form the source code which can be found at https://github.com/apple/swift

like image 21
discorevilo Avatar answered Sep 22 '22 06:09

discorevilo