Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question UnityFramework isn't symbolicated in ios crash report

Discussion in 'iOS and tvOS' started by monty_python, Feb 7, 2021.

  1. monty_python

    monty_python

    Joined:
    Mar 4, 2017
    Posts:
    18
    Hello,
    I am trying to figure out why are my crash reports only partially symbolicated. I am using IL2CPP with following options selected in build settings:
    Run in Xcode as: Debug
    Development Build: True
    Script Debugging: True
    It is worth noting that I am building on Windows, afterwards I transfer build to Mac where I compile for iOS using Xcode.

    When my app crashes, I go to Devices & Simulators in Xcode -> View Device Logs to take a look at crash report. Unfortunately this doesn't help me since stack trace is only partially symbolicated (UnityFramework calls aren't symbolicated). Please take a look at attached image to see an example of such crash report.

    Please is there something I could do in order to properly symbolicate whole crash report? Thanks.
     

    Attached Files:

  2. monty_python

    monty_python

    Joined:
    Mar 4, 2017
    Posts:
    18
    Bump :)
    Please does anyone know how to go about symbolicating UnityFramework in stack trace?
     
  3. monty_python

    monty_python

    Joined:
    Mar 4, 2017
    Posts:
    18
    Bump :)
    Please does anyone have a clue what might be happening here? Thanks.
     
  4. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    513
    The symbols would be restored automatically in that window if all the matching dSYM files can be found on your machine.

    Follow section "Locate a dSYM Using Spotlight" of this Apple article on how to locate and verify dSYM being present:
    https://developer.apple.com/documen...fiable_symbol_names_to_a_crash_report#3403787
     
  5. monty_python

    monty_python

    Joined:
    Mar 4, 2017
    Posts:
    18
    Thanks, but I still don't understand what might be causing the problem. Maybe dSYM file for UnityFramework binary is being stored somewhere else than in Build folder and therefore it doesn't get copied from Windows to Mac? Maybe I should have Unity installed also on Mac as this dSYM file is located inside of the installation? I will try to search for this dSYM in order to better understand what is happening and will post if I figure something out.
     
  6. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    513
    dSYM for UnityFramework is generated during compilation. If you copied the Xcode project to Mac and built the project there it should be on your Mac, in the temporary Products folder where the debug version of the App is. After a Run build, show the UnityFramework in Finder (like so), and the dSYM should be right next to the framework. If not, double check the build settings of UnityFramework target and see if "Debug Informtaion Format" is set to anything other than "DRAWF with dSYM File".
    upload_2021-2-24_20-50-12.png
     
  7. monty_python

    monty_python

    Joined:
    Mar 4, 2017
    Posts:
    18
    Thank you very much for info.
    I have checked UnityFramework in finder, but dSYM was missing as you have suggested. Therefore I have looked at build settings in Xcode and it seems like dSYM isn't generated by default for Debug target (which I am using). Also by default stripping of Debug Symbols is disabled, which probably allows Xcode debugger to work properly. I will try to set this to "DRAWF with dSYM File" and see if symbolication will be successful on the next crash.

    upload_2021-2-25_11-16-22.png

    While reading some threads at stackoverflow I came across this:
    So to sum up: use DWARF for edit/compile/debug cycles if you have large projects and want to avoid the time it takes to link a dSYM file during your daily workflow. Use DWARF with dSYM all the time if you have smaller projects, doing release builds, or need other Apple tools that are not debuggers to be able to parse your debug information. Both formats contain the same kind of information and can be used for debugging, but not all tools can load the DWARF format where the DWARF is left in the .o files.​

    Now it makes a bit more sense to me as it sounds like Unity configures Debug build target in a way that should be only used when the device is connected to Xcode for debugging... Once it isn't connected to debugger, it is probably better to compile using Release build target (in order to support symbolication of crash reports trough dSYM files). So far I have been using only Debug target (even in situations where app wasn't connected to Xcode for debugging) and that was most probably the root of my symbolication problems. Please correct me if I am wrong here.

    As a side question I would like to ask how could one go about explicitly telling Unity to generate Xcode project with "DRAWF with dSYM File" enabled even for Debug builds? It is easy to manipulate this value afterwards in Xcode, but this will change back every time I build new Xcode project from Unity - which is kind of problematic in case one would forget to change it.

    Thanks once again for help :)
     
    Petr777 likes this.
  8. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    513
    You can use a post-build processing script. I haven't got time to write one, so I'll list all the relevant APIs for you:

    1. For the build folder, get the path to the pbxproj file
    https://docs.unity3d.com/ScriptReference/iOS.Xcode.PBXProject.GetPBXProjectPath.html

    2. Read that file into a new PBXProject instance
    https://docs.unity3d.com/ScriptReference/iOS.Xcode.PBXProject.ReadFromFile.html

    3. Get the UnityFramework target GUID. (Xcode uses this kind of references in pbxproj. Seems cumbersome, but that's what we have to work with. )
    https://docs.unity3d.com/ScriptReference/iOS.Xcode.PBXProject.GetUnityFrameworkTargetGuid.html

    4. With the GUID of the target, get the GUID for "Debug" config
    https://docs.unity3d.com/ScriptReference/iOS.Xcode.PBXProject.BuildConfigByName.html

    5. With the GUID of the desired config, for "DEBUG_INFORMATION_FORMAT" property, set it to "dwarf-with-dsym".
    https://docs.unity3d.com/ScriptReference/iOS.Xcode.PBXProject.SetBuildPropertyForConfig.html

    After the modification, don't forget to write the file back:
    https://docs.unity3d.com/ScriptReference/iOS.Xcode.PBXProject.WriteToFile.html

    Alternatively:
    4. With the GUID of the target, set "DEBUG_INFORMATION_FORMAT" to "dwarf-with-dsym" for all configurations.
    https://docs.unity3d.com/ScriptReference/iOS.Xcode.PBXProject.SetBuildProperty.html

    You are probably right. Usually Debug build is useful if you can have a debugger attached so you can break and step during debug run. I usually run unattached after I am sure that things are stable when connected.

    --------

    It's probably not useful in your current workflow since you build first on Windows, but, if you build your Unity project on Mac, you actually have an option to append to a previous Xcode project. In that way, the Xcode project will remain mostly unmodified.
     
    Last edited: Feb 25, 2021
  9. monty_python

    monty_python

    Joined:
    Mar 4, 2017
    Posts:
    18
    Great, I will take a look at creating such post-build script. Thank you very much for all information, this helped me a lot.
     
  10. cyliax

    cyliax

    Joined:
    Feb 25, 2014
    Posts:
    18
    I had the same issue and in my case setting UnityFramework DEBUG_INFORMATION_FORMAT to DWARF (without dsym!) was solving my problem for now. I'm not sure, if that should stay like this forever. My Jenkins build wasn't going through with Unity 2019.4.20f1 and Vuforia 9.8.5 and I don't know where this issue exactly came from.

    Here is the post-build processing script:

    Code (CSharp):
    1. using System.IO;
    2. using UnityEditor;
    3. using UnityEditor.Callbacks;
    4. using UnityEditor.iOS.Xcode;
    5.  
    6. public class SetUnityFrameworkDebugInformationFormatToDWARF
    7. {
    8.     [PostProcessBuild(1)]
    9.     public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
    10.     {
    11.         if (buildTarget == BuildTarget.iOS)
    12.         {
    13.             var pbxPath = PBXProject.GetPBXProjectPath(path);
    14.             var pbxProject = new PBXProject();
    15.  
    16.             pbxProject.ReadFromString(File.ReadAllText(pbxPath));
    17.  
    18. #if UNITY_2019_4_OR_NEWER
    19.             var targetGUID = pbxProject.GetUnityFrameworkTargetGuid();
    20. #else
    21.             var targetName = PBXProject.GetUnityTargetName();
    22.             var targetGUID = pbxProject.TargetGuidByName(targetName);
    23. #endif
    24.  
    25.             pbxProject.SetBuildProperty(targetGUID, "DEBUG_INFORMATION_FORMAT", "DWARF");
    26.  
    27.             File.WriteAllText(pbxPath, pbxProject.WriteToString());
    28.         }
    29.     }
    30. }
     
  11. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    @Neonlyte I have my dSYM file alongside UnityFramework.framework but Xcode is not fully symbolicating. I've even been through Apple's steps to check that the UUIDs match.

    Screenshot 2021-04-14 at 15.49.50.png

    Screenshot 2021-04-14 at 15.52.45.png

    Any ideas?

    Thanks.