Debugging on macOS, using dSYM files provided by UE4 installer

I want to be able to use lldb, see full call stack and step into engine sources.
It works out of the box on Windows in with PDBs provided. But on macOS dSYMs are not loaded by lldb.

Of course it is possible to attach dSYM during the debugging session. Like this for example:

settings set target.source-map “/Users/build/Build/++UE4/Sync” “/Users/Shared/Epic Games/UE_4.23”
add-dsym “/Users/Shared/Epic Games/UE_4.23/Engine/Binaries/Mac/UE4Editor-Engine.dSYM”

But it’s quite tedious. Ideally all dSYMs should be loaded automatically.

After some googling I’ve found a good write up on the topic: Attaching sources to iOS/macOS binaries compiled on another machine | by Max Raskin | Medium
So I’ve modified ruby script from that article for the purpose of automation loading UE4 dSYMs by lldb.
Here is the link: https://gist.github.com/intvoker/464…794af99caf181d

So what it does in a few words:
For every binary (.app or .dylib) inside “/Users/Shared/Epic Games/UE_4.23/Engine/Binaries/Mac” it creates a directory {binary_name}.dSYM.
Inside that directory it creates:

  • Property list file: {binary_name}.dSYM/Contents/Resources/{uuid}.plist
  • Symlink to actual dSYM: {binary_name}.dSYM/Contents/Resources/DWARF/{binary_name}.dSYM

After that files are created lldb loads dSYMs automatically and I can debug engine code.
I’ve tested this approach on 4.23 and 4.25.

So my question - does it all make sense? And what is the right approach?

P.S. I understand that building the engine from source also solves the discussed problem. The question is how to use symbols for debugging that are provided by UE4 installer.

3 Likes

Great findings! I find it strange that this would be the official way of fixing this.
I wonder how we can get someone from Epic Games to see this so they can confirm whether this is the way to go even 3 years after

Just use Rider :wink:

So my question - does it all make sense? And what is the right approach?

Yes, it does. This is the right approach as the symbols were built on a different machine from which you’re debugging Unreal in. So lldb is unable to resolve the breakpoints when using absolute file paths. Therefore, a mapping between the building source path and the source path on your machine needs to be created.

After reading your post, I eventually ran into the tutorial below, which goes in more details into how it all works.

I got this working with Unreal 5.4.3 and Xcode 15.4.

I ran into a few more issues before I got symbols to work on my Mac but the " How Do I Check If I Have Debug Symbols?" section in the LLDB Troubleshooting page helped figure out what was wrong with the differences in base paths between the build source path and the source paths on my machine.

1 Like