Group iOS treemap by known libraries#632
Conversation
Recognize statically-linked third-party libraries in the iOS main binary (by Swift module name and ObjC class prefix) via a curated catalog, and group recognized module/class nodes under a single "Libraries" node. Generated with [Linear](https://linear.app/getsentry/issue/EME-139/group-ios-by-known-libraries#agent-session-8fb42254) Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
📲 Install BuildsiOS
Android
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7282aeb. Configure here.
| if node_name.startswith(prefix): | ||
| return library_name | ||
|
|
||
| return None |
There was a problem hiding this comment.
Prefix matching mislabels modules
Medium Severity
resolve_known_library runs Objective-C prefix checks on every symbol child name, including Swift module nodes, so first-party modules that only share a prefix (for example Branch or SentryUI) can be grouped under third-party Libraries. The Datadog DD prefix is two characters and matches unrelated ObjC types such as CocoaLumberjack’s DDLog, despite the catalog comment requiring 3+ character prefixes.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 7282aeb. Configure here.


The iOS main-binary treemap breaks the executable into per-Swift-module and per-ObjC-class nodes, all flat alongside segments/metadata — with no way to tell the app's own code apart from statically-linked third-party SDKs. This is the iOS analog of EME-108 (group dex by known libraries).
This adds a curated catalog of well-known iOS libraries (
known_libraries.py) keyed by Swift module name and distinctive ObjC class prefixes (Sentry, Firebase, Alamofire, Lottie, GoogleMaps, Realm, etc.). InMachOElementBuilder, recognized module/class nodes are pulled out and grouped under a singleLibrariesnode; the app's own modules stay as direct children. Sizes are preserved (nodes are only re-parented), so the existing size-accounting check still holds, and no newTreemapType/frontend changes are needed.Example:
The catalog is intentionally conservative and easy to extend.
Testing
resolve_known_libraryand for the grouping behavior (Swift-module breakdown depends on the macOS-onlycwl-demangle, so grouping is unit-tested with synthetic symbol data rather than via the Darwin-only integration tests).make checkpasses (lint/format/types).