Search Unity

BurstDebugInformation_DoNotShip in builds

Discussion in 'Burst' started by dgoyette, Sep 20, 2021.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    After a fairly recent update to Burst, I'm not seeing a folder named this in my builds:

    Gravia_BurstDebugInformation_DoNotShip

    A couple of questions:

    1) Why is this being generated? I'm creating a Release build of my game, not a dev build. Is there a setting that is causing this to be generated?

    2) Can I prevent this from being generated? It seems like I have "Force Debug Information" unchecked, but this is still being created:

    upload_2021-9-20_16-1-58.png

    3) What is the consequence of deploying this with a build, in the event that I somehow overlook deleting it from the build? It ultimately contains a single file named "lib_burst_generated"

    Thanks.
     
    LilGames, ROBYER1 and AldeRoberge like this.
  2. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    Any chance you could paste what Burst version you are using?

    I think all that should be in there is a .txt file with some info in there. It definitely should be able to be deleted. I vaguely remember we had some fixes around this area so just wanna check what version you are on for starters!
     
    dgoyette likes this.
  3. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    258
    in my experience, 1.6.0 introduced this file for pretty much all builds. We had to adjust all our CI jobs to ignore that folder, felt a bit messy - but doable
     
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    Thanks. I'm on 1.6.0, same as @Carpet_Head. I didn't see this when doing builds on earlier versions of Burst.

    And yes, if I drill down in that directory, all I ultimately find is "lib_burst_generated.txt". I assumed it was not necessary to run the game (since otherwise why would it tell me not to ship that content), but I wanted to know whether there was any consequence if I were to ship it, by mistake.
     
  5. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    No consequences if you ship it by mistake - that folder should probably be called 'NoDangerIfYouDoNotShipThis' -> its just for aiding in debugging.
     
    awsapps, MiguelCoK and dgoyette like this.
  6. HarryCodder

    HarryCodder

    Joined:
    Feb 20, 2015
    Posts:
    84
    Hi,
    Is there a clean way to prevent Unity from generating this folder ?
     
  7. aizuon

    aizuon

    Joined:
    Jun 24, 2014
    Posts:
    7
    You could try setting up a post build script and delete it each time
     
  8. HarryCodder

    HarryCodder

    Joined:
    Feb 20, 2015
    Posts:
    84
    This is what I'm doing at the moment, I guess it works but I was hoping there might be an hidden setting somewhere to just skip its creation altogether.
     
    Karamelka322, Foreman_Dev and ROBYER1 like this.
  9. oobartez

    oobartez

    Joined:
    Oct 12, 2016
    Posts:
    167
    @sheredom Is there a way to turn it off altogether? It clutters the hard drive and complicates some automation tasks.
     
  10. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    I am also wondering if there is a way to stop it from being created? @sheredom I will request this on the roadmap
     
    oobartez likes this.
  11. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    I'll file an issue in Burst to add an AOT build option to disable the folder. Note we generate this folder so that we can help y'all debug your built games, that's why we generate it but put the suffix on it for DoNotShip.
     
    Jesper-Nielsen, RogDolos and ROBYER1 like this.
  12. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Thanks, no harm in it being on by default to generate such files, but most useful to us developers is an option to disable it if we choose to for various reasons of not wanting extra folders in the build folder close to release etc
     
    R2-RT likes this.
  13. Iseefires

    Iseefires

    Joined:
    Apr 3, 2020
    Posts:
    1
    By any chance, is it possible to share this code?
     
  14. HarryCodder

    HarryCodder

    Joined:
    Feb 20, 2015
    Posts:
    84
    This is how I do it:

    At the end of my build function I call the following DeleteBurstDebugInformationFolder function with the build report returned by the BuildPipeline.BuildPlayer function (only if the build succeeded).

    Code (CSharp):
    1. static void DeleteBurstDebugInformationFolder([NotNull] BuildReport buildReport)
    2. {
    3.     string outputPath = buildReport.summary.outputPath;
    4.  
    5.     try
    6.     {
    7.         string applicationName = Path.GetFileNameWithoutExtension(outputPath);
    8.         string outputFolder = Path.GetDirectoryName(outputPath);
    9.         Assert.IsNotNull(outputFolder);
    10.  
    11.         outputFolder = Path.GetFullPath(outputFolder);
    12.  
    13.         string burstDebugInformationDirectoryPath = Path.Combine(outputFolder, $"{applicationName}_BurstDebugInformation_DoNotShip");
    14.  
    15.         if (Directory.Exists(burstDebugInformationDirectoryPath))
    16.         {
    17.             Debug.Log($" > Deleting Burst debug information folder at path '{burstDebugInformationDirectoryPath}'...");
    18.  
    19.             Directory.Delete(burstDebugInformationDirectoryPath, true);
    20.         }
    21.     }
    22.     catch (Exception e)
    23.     {
    24.         Debug.LogWarning($"An unexpected exception occurred while performing build cleanup: {e}");
    25.     }
    26. }
     
  15. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    I made a helper script for this which does the following once a build has ran:

    1. If building for IOS, removes the Xcode build target platform 'My Mac' which would otherwise try to automatically run your IOS app on your Mac when using Build & Run from Unity on Xcode build target
    2. If using the Burst package, the Burst Debug folder will be deleted on a successful build
    3. If building for il2cpp, the il2cpp Debug folder will be deleted on a successful build

    Code (CSharp):
    1. using System;
    2. using System.IO;
    3. using UnityEditor;
    4. using UnityEditor.Callbacks;
    5. #if UNITY_IOS
    6. using UnityEditor.iOS.Xcode;
    7. #endif
    8. using UnityEngine;
    9. using UnityEngine.Assertions;
    10.  
    11. public class CleanupPostProcessorBuild
    12. {
    13.  
    14.     [PostProcessBuild(2000)]
    15.     public static void OnPostProcessBuild(BuildTarget target, string path)
    16.     {
    17. #if UNITY_IOS
    18.         Debug.Log("iOSBuildPostProcess is now postprocessing iOS Project");
    19.  
    20.         var projectPath = PBXProject.GetPBXProjectPath(path);
    21.  
    22.         var project = new PBXProject();
    23.         project.ReadFromFile(projectPath);
    24.  
    25.         var targetGuid = project.GetUnityMainTargetGuid();
    26.  
    27.         project.SetBuildProperty(targetGuid, "SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD", "NO");
    28.  
    29.         try
    30.         {
    31.             var projectInString = File.ReadAllText(projectPath);
    32.             projectInString = projectInString.Replace("SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;",
    33.                 $"SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;");
    34.             File.WriteAllText(projectPath, projectInString);
    35.         }
    36.         catch (Exception e)
    37.         {
    38.             Debug.LogException(e);
    39.         }
    40.  
    41.         project.WriteToFile(projectPath);
    42. #endif
    43.         string outputPath = path;
    44.  
    45.         try
    46.         {
    47.             string applicationName = Path.GetFileNameWithoutExtension(outputPath);
    48.             string outputFolder = Path.GetDirectoryName(outputPath);
    49.             Assert.IsNotNull(outputFolder);
    50.  
    51.             outputFolder = Path.GetFullPath(outputFolder);
    52.  
    53.             //Delete Burst Debug Folder
    54.             string burstDebugInformationDirectoryPath = Path.Combine(outputFolder, $"{applicationName}_BurstDebugInformation_DoNotShip");
    55.  
    56.             if (Directory.Exists(burstDebugInformationDirectoryPath))
    57.             {
    58.                 Debug.Log($" > Deleting Burst debug information folder at path '{burstDebugInformationDirectoryPath}'...");
    59.  
    60.                 Directory.Delete(burstDebugInformationDirectoryPath, true);
    61.             }
    62.  
    63.             //Delete il2cpp Debug Folder
    64.             string il2cppDebugInformationDirectoryPath = Path.Combine(outputFolder, $"{applicationName}_BackUpThisFolder_ButDontShipItWithYourGame");
    65.  
    66.             if (Directory.Exists(il2cppDebugInformationDirectoryPath))
    67.             {
    68.                 Debug.Log($" > Deleting Burst debug information folder at path '{il2cppDebugInformationDirectoryPath}'...");
    69.  
    70.                 Directory.Delete(il2cppDebugInformationDirectoryPath, true);
    71.             }
    72.         }
    73.         catch (Exception e)
    74.         {
    75.             Debug.LogWarning($"An unexpected exception occurred while performing build cleanup: {e}");
    76.         }
    77.     }
    78.  
    79. }
     
  16. pappaxray2

    pappaxray2

    Joined:
    Mar 30, 2016
    Posts:
    12
    It would be nice if there was an option to disable it's generation, esp if people are having to write code to delete them afterwards. Otherwise it's somewhat error prone and takes up a lot of space if you're using CI, our il2cpp debug output is 1.2GB
     
    antnasce, CloudyVR and oobartez like this.
  17. chase_unity38

    chase_unity38

    Joined:
    Jan 5, 2022
    Posts:
    8
    @sheredom can you help illuminate how we would use this file to help debug built games? I would prefer to delete the file, seeing no obvious use for it, but maybe there's something I'm missing? I couldn't find anything about this in a couple google searches either
     
  18. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    1,700
    This is more a guess in the blue, but I'd assume this is what allows you to see the error-cause sourcecode with a regular process debugger (visual studio -> debug -> attach to process -> select your running game) when an error occurs.
     
    sheredom likes this.
  19. oobartez

    oobartez

    Joined:
    Oct 12, 2016
    Posts:
    167
    The folder gets generated even if it is empty, without any files in it other than empty folders. Can we get an option to disable it, or at least have Unity not generate it if it doesn't contain any files?
     
  20. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Burst is compiled to native machine code, which is made of raw binary CPU instructions. When such code crashes in the wild (for example, on people's Android devices) it generates a crash dump with native stack traces which are just a bunch of memory address offsets into the native binary since native code doesn't contains things like function names.

    That folder contains debug symbol files generated during build contains a map of the source code to the final machine binary code, and is used to make a crash dump stack trace human-readable. Without it you'll have little hope of debugging crashes that happen on users' devices. That's usually when people learn the hard way they actually need to keep those files somewhere.

    Also, you cannot generate those after the fact: the symbol information is only valid for the executables generated alongside it. If you build again even without any changes both the binary and the symbols will be different.
     
    npatch and chase_unity38 like this.
  21. chase_unity38

    chase_unity38

    Joined:
    Jan 5, 2022
    Posts:
    8
    ah cool, thanks for the explanation @Neto_Kokku, that makes perfect sense. I'm accustomed to saving the symbols for builds already, good to know this is another artifact to hang on to
     
  22. avrahamy

    avrahamy

    Joined:
    Jun 10, 2022
    Posts:
    5
    How can I use the pdb or dSYM files to convert addresses from a stacktrace to a line number?
    I couldn't find information on it online...
     
  23. antnasce

    antnasce

    Joined:
    Apr 27, 2019
    Posts:
    12
    Yeah, honestly, why do we need to make a post-build script to clean up a folder that we don't want to ship?
     
    JoaCHIP and Pnvanol like this.
  24. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    864
    Why not use the designated log folders to store this information. Why on earth choose to clutter the build folder for everyone? Unbelievable.
     
    LilGames likes this.
  25. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    287
    Hi @cecarlsen - were you referring to BackupUpThisFolder_ButDontShipItWithYourGame?
     
  26. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    864
    The BurstDebugInformation_DoNotShip folder.
     
  27. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    287
    That's the folder we use now, but I was wondering which folder you meant by "designated log folders"?
     
  28. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    864
    Oh I was thinking the player log folder. On windows:
    %USERPROFILE%\AppData\LocalLow\CompanyName\ProductName\
     
  29. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    287
    Ah, I see. Actually what we'd like to do is move these debug files (which contain important information for debugging player builds) from the current BurstDebugInformation_DoNotShip folder to the
    BackUpThisFolder_ButDontShipItWithYourGame folder that's already used for non-Burst debugging symbols etc, so that we can standardise on a single folder for files of this type. We "just" need to find time to make that change.
     
  30. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    864
    When you do make that change, please also make an option to disable it so that we don't have to make our own hacky build processor scripts.
     
  31. ayomichael10

    ayomichael10

    Joined:
    Dec 7, 2020
    Posts:
    2
    i get this folder alone when building apk but no apk. please can someone help solve this
     
  32. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    287
  33. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    501
    Wouldn't it make sense to only make this folder for debug builds, then?
     
    Bwacky likes this.
  34. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    209
    Exactly this. Accidentally zipping a quick build for testers in release mode, and ending up with all that debug data shipped is a regular occurrence since it's easy to forget there's that damn debug folder inside. I took a look through the files and it lists things I think I'd rather people not know are part of the builds, so it'd be nice to be able to simply disable the generation of that data completely. Nobody has to know what namespaces, packages or dll's I'm using. I'd wager most people delete that to begin with or simply send their games up to the cloud with it, blisfully unaware.