feat(android): emit ELF GNU build-id for NDK native-crash images#1
Merged
Conversation
nimisha-gj
suggested changes
Jun 16, 2026
Adds each native image's ELF GNU build-id as `uuid` in `crash.binary_images_json` so the backend symbolizer can match Android NDK (.so) crash frames to uploaded symbols — the analog of an iOS dSYM UUID (SPEC §5.4 multi-image symbolication). The crash signal handler stays async-signal-safe: it still captures only each image's base address + name. The build-id is recovered at report-assembly time on a normal thread (CrashReporter.getPendingCrashReports) by resolving the image name against the app's nativeLibraryDir and reading NT_GNU_BUILD_ID from the on-disk library via a new minimal ELF parser (ElfBuildId). Images that can't be resolved — system libraries, or libs not extracted to disk — are left without a uuid and their frames stay raw. iOS dSYM images already carry a per-image uuid (from KSCrash) and are unchanged. Adds a JUnit unit test (with a committed ELF .so fixture) and wires up the android unit-test source set.
6b564fa to
50b843a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Enables backend symbolication of Android NDK (
.so) native crash frames by emitting each native image's ELF GNU build-id asuuidincrash.binary_images_json— the analog of an iOS dSYM UUID (Scout RUM SPEC §5.4 multi-image symbolication). Without this, NDK images carry only{base, path}and cannot be matched to uploaded symbols.iOS dSYM images already carry a per-image
uuid(from KSCrash) and are unchanged.How
ElfBuildId.kt— a minimal, pure-JVM ELF parser that readsNT_GNU_BUILD_IDfrom an on-disk.so(handles 32/64-bit, LE/BE; defensive bounds checks).CrashReporter.getPendingCrashReports— enrichescrash.binary_images_jsonat report-assembly time, on a normal thread (next launch), by resolving each image's basename against the app'snativeLibraryDirand reading its build-id. The async-signal-safe crash handler is untouched (it still captures only base + name).uuid→ their frames stay raw, nothing errors.Testing
ElfBuildIdTest(JUnit) reads a committed ELF.sofixture and asserts the build-id, plus missing-file / non-ELF cases. Adds the android unit-test source set +junittest dependency.Notes
.sodebug_idmust use the same GNU build-id (readelf -n) for matching — to be covered in the CI upload docs.