fix(debug-files): map targeted object for --il2cpp-mapping + free WASM handles#1166
Merged
Conversation
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).
Contributor
|
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 5143 uncovered lines. 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 |
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.
Post-merge follow-ups for the
debug-filesDIF work (#1163, #1165).1.
fix: map the targeted object for--il2cpp-mappingAddresses a Cursor Bugbot finding on #1165 ("IL2CPP mapping wrong object", Medium).
For a fat archive,
createIl2cppLineMappingmapped the first debug-info object (selectBundledObjectover all objects), while the uploaded.il2cppDIF was stamped withfile.debugId(the filter-matched primary). With--idtargeting a non-primary slice, the DIF could advertise one debug id while containing another object's line mappings.createIl2cppLineMappingnow takes atargetDebugIdand maps that specific object (falling back toselectBundledObjectwhen omitted/not found).appendIl2cppMappingpassesfile.debugIdand 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 useAddresses review finding M-1. The DIF helpers (
parseDebugFile,extractEmbeddedPpdb,createSourceBundle,createIl2cppLineMapping,listSources) createdArchive/PeFileWASM handles that were never released, so a scan accumulated them (and their backing byte views) in WASM linear memory until process exit.usingso the handle is freed on return.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.