Crashlytics names Unity IL2CPP frames by the last `__text` symbol (code in `__TEXT,il2cpp` is not symbolicated)

Aperta
#1,560 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp, ios, unity

Direzione di ricerca

Start by tracing Crashlytics symbolication for Unity iOS frames and how it selects symbols from Mach-O sections. The report identifies __TEXT,il2cpp as the section whose symbols are missed and provides nm, atos, and dSYM examples to reproduce the discrepancy. Done means IL2CPP frames resolve to their own symbols and source locations; no source files or tests are named in the issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

api: crashlytics type: question

Environment: Unity 6000.3.10f1 (IL2CPP, iOS arm64), Firebase Unity SDK 14.0.0, firebase-ios-sdk 13.0.1 through SPM, Xcode 27.0, iOS 27.0.1.

In a Unity game on iOS every crash frame that lands in the game's own code shows up in Crashlytics like this:

4  UnityFramework  +[UIViewController(APMScreenClassName) load].cold.1 + 58254812
5  UnityFramework  +[UIViewController(APMScreenClassName) load].cold.1 + 5880816
6  UnityFramework  +[UIViewController(APMScreenClassName) load].cold.1 + 53461080

The issue also gets its title from that symbol, so crashes in different game functions would group together. Engine frames in the same binary are symbolicated fine, with file and line. The dSYMs of both UnityFramework and the app show as Uploaded in the dSYMs tab.

I think the cause is where Unity puts the generated code. IL2CPP compiles C# methods with __attribute__((section("__TEXT,il2cpp,regular,pure_instructions"))) (IL2CPP_METHOD_ATTR in libil2cpp/os/c-api/il2cpp-config-platforms.h), so UnityFramework gets a second code section right after __text, and most of the code is there:

$ size -m UnityFramework.framework.dSYM/Contents/Resources/DWARF/UnityFramework
Segment __TEXT: 98959360
	Section __text: 24425816
	Section il2cpp: 61729148

The symbol Crashlytics picks is exactly the last one of __text, and the next symbol is the first of il2cpp:

$ nm -n -m UnityFramework | grep -A1 'APMScreenClassName) load].cold.1'
000000000174f544 (__TEXT,__text) non-external +[UIViewController(APMScreenClassName) load].cold.1
000000000174f558 (__TEXT,il2cpp) non-external (was a private external) _CanvasExtensions_ShouldGammaToLinearInMesh_m5452ACD7E987301A30A72812E4D86720D5B9BDE5

The dSYM itself has everything. It has about 269k symbols in (__TEXT,il2cpp) and DWARF for the generated .cpp files, and atos resolves those addresses with file and line:

$ atos -o UnityFramework.framework.dSYM/Contents/Resources/DWARF/UnityFramework -arch arm64 -l 0 0x174f600
Color32Extensions_LinearToGamma_m254DEAA3F6BB7D912898E80AE34B83EBEAD8740F (in UnityFramework) (Coffee.UIParticle.cpp:3022)

So it looks like the symbolication only uses symbols from __TEXT,__text and takes the nearest one before the address. Could it also use the symbols of the other code sections of __TEXT (the ones marked S_ATTR_PURE_INSTRUCTIONS)? Every Unity IL2CPP game on iOS has this section, so I'd guess most of them see the same thing.

Turning the section off in IL2CPP isn't a good workaround for us, because the IL2CPP runtime uses its bounds to build managed stack traces. For now I resolve these frames by hand with atos (symbol address from the dSYM plus the offset Crashlytics shows).

Let me know if you need a sample dSYM or a crash ID, I can share them privately.

Lingua principale
C#
Stelle
325
Fork
62
Merge medio
1g 17h
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di firebase/firebase-unity-sdk

Tutte le issue di firebase/firebase-unity-sdk

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.