Skip to content

Group iOS treemap by known libraries#632

Draft
trevor-e wants to merge 1 commit into
mainfrom
trevorelkins/eme-139-group-ios-by-known-libraries-62f2
Draft

Group iOS treemap by known libraries#632
trevor-e wants to merge 1 commit into
mainfrom
trevorelkins/eme-139-group-ios-by-known-libraries-62f2

Conversation

@trevor-e

Copy link
Copy Markdown
Member

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.). In MachOElementBuilder, recognized module/class nodes are pulled out and grouped under a single Libraries node; 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 new TreemapType/frontend changes are needed.

Example:

MainBinary
├─ Libraries
│  ├─ Firebase        ← FirebaseCore + FirebaseAnalytics
│  ├─ Sentry
│  └─ Alamofire
├─ MyApp              ← first-party module, stays flat
├─ __TEXT, __DATA …

The catalog is intentionally conservative and easy to extend.

Testing

  • New unit tests for resolve_known_library and for the grouping behavior (Swift-module breakdown depends on the macOS-only cwl-demangle, so grouping is unit-tested with synthetic symbol data rather than via the Darwin-only integration tests).
  • make check passes (lint/format/types).

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>
@linear-code

linear-code Bot commented Jun 18, 2026

Copy link
Copy Markdown

EME-139

@sentry

sentry Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📲 Install Builds

iOS

🔗 App Name App ID Version Configuration
HackerNews com.emergetools.hackernews 3.8 (1) Release

Android

🔗 App Name App ID Version Configuration
Hacker News com.emergetools.hackernews 1.0.2 (13) Release

⚙️ launchpad-test-android Build Distribution Settings

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7282aeb. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant