Skip to content

fix(debug-files): map targeted object for --il2cpp-mapping + free WASM handles#1166

Merged
BYK merged 2 commits into
mainfrom
byk/fix/debug-files-il2cpp-target-object
Jul 2, 2026
Merged

fix(debug-files): map targeted object for --il2cpp-mapping + free WASM handles#1166
BYK merged 2 commits into
mainfrom
byk/fix/debug-files-il2cpp-target-object

Conversation

@BYK

@BYK BYK commented Jul 2, 2026

Copy link
Copy Markdown
Member

Post-merge follow-ups for the debug-files DIF work (#1163, #1165).

1. fix: map the targeted object for --il2cpp-mapping

Addresses a Cursor Bugbot finding on #1165 ("IL2CPP mapping wrong object", Medium).

For a fat archive, createIl2cppLineMapping mapped the first debug-info object (selectBundledObject over all objects), while the uploaded .il2cpp DIF was stamped with file.debugId (the filter-matched primary). With --id targeting a non-primary slice, the DIF could advertise one debug id while containing another object's line mappings.

  • createIl2cppLineMapping now takes a targetDebugId and maps that specific object (falling back to selectBundledObject when omitted/not found).
  • appendIl2cppMapping passes file.debugId and stamps the DIF with the mapped object's own id — so the id always matches the contents.

Tests: added cases asserting the returned id tracks the targeted object and the fallback path.

2. perf: free WASM archive handles after use

Addresses review finding M-1. The DIF helpers (parseDebugFile, extractEmbeddedPpdb, createSourceBundle, createIl2cppLineMapping, listSources) created Archive/PeFile WASM handles that were never released, so a scan accumulated them (and their backing byte views) in WASM linear memory until process exit.

  • Declared each with using so the handle is freed on return.
  • Each helper returns only plain values or copied byte buffers, so releasing the archive is safe. Verified empirically that disposing the archive independently of the objects derived from it does not double-free (symbolic's self-cell objects own their data), including after forcing GC.

Verification

typecheck, lint, check:deps, check:fragments, and the full debug-files/dif/scan suite (360 tests) all pass. No behavior change for the common single-object case.

BYK added 2 commits July 2, 2026 11:48
For a fat archive, `createIl2cppLineMapping` mapped the first debug-info
object (`selectBundledObject` over all objects) while the DIF was stamped
with `file.debugId` (the filter-matched primary). With `--id` targeting a
non-primary slice, the uploaded `.il2cpp` DIF could advertise one debug id
but contain another object's line mappings.

`createIl2cppLineMapping` now accepts a `targetDebugId` and maps that
object (falling back to `selectBundledObject`), and `appendIl2cppMapping`
stamps the DIF with the mapped object's own id — so the id always matches
the contents.
The DIF helpers created `Archive`/`PeFile` WASM handles that were never
released, so a scan accumulated them (and their backing byte views) in
WASM linear memory until process exit. Declare them with `using` so the
handle is freed when the function returns. Each helper only returns plain
values or copied byte buffers, so releasing the archive is safe (verified:
disposing the archive independently of the objects derived from it does
not double-free, as symbolic's self-cell objects own their data).
@github-actions github-actions Bot added the risk: low PR risk score: low label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1166/

Built to branch gh-pages at 2026-07-02 11:53 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 5143 uncovered lines.
✅ Project coverage is 81.51%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.51%    81.51%        —%
==========================================
  Files          399       399         —
  Lines        27809     27811        +2
  Branches     18063     18065        +2
==========================================
+ Hits         22666     22668        +2
- Misses        5143      5143         —
- Partials      1864      1864         —

Generated by Codecov Action

@BYK BYK merged commit 773c438 into main Jul 2, 2026
30 checks passed
@BYK BYK deleted the byk/fix/debug-files-il2cpp-target-object branch July 2, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant