Add WasmFileKeyGenerator for split Wasm symbol files#5853
Conversation
|
@paolosevMSFT please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement ( “Agreement” ) is agreed to by the party signing below ( “You” ), 1. Definitions. “Code” means the computer software code, whether in human-readable or machine-executable form, “Project” means any of the projects owned or managed by .NET Foundation and offered under a license “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any “Submission” means the Code and any other copyrightable material Submitted by You, including any 2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any 3. Originality of Work. You represent that each of Your Submissions is entirely Your 4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else 5. Licenses. a. Copyright License. You grant .NET Foundation, and those who receive the Submission directly b. Patent License. You grant .NET Foundation, and those who receive the Submission directly or c. Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement. 6. Representations and Warranties. You represent that You are legally entitled to grant the above 7. Notice to .NET Foundation. You agree to notify .NET Foundation in writing of any facts or 8. Information about Submissions. You agree that contributions to Projects and information about 9. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and 10. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and .NET Foundation dedicates this Contribution License Agreement to the public domain according to the Creative Commons CC0 1. |
There was a problem hiding this comment.
Pull request overview
Adds WebAssembly module support to Microsoft.SymbolStore key generation by introducing a WasmFileKeyGenerator that extracts a build_id custom section and distinguishes stripped vs split-debug Wasm files via .debug_* custom sections, enabling symbol-server indexing using wasm-buildid and wasm-buildid-sym prefixes.
Changes:
- Added
WasmFileKeyGeneratorto parse Wasm headers/sections, extractbuild_id, and detect DWARF debug sections. - Updated
FileKeyGeneratorauto-detection chain to include Wasm support. - Added unit tests covering Wasm modules, symbol files, and missing build IDs.
Reviewed changes
Copilot reviewed 3 out of 6 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/tests/Microsoft.SymbolStore.UnitTests/KeyGeneratorTests.cs | Adds unit tests for Wasm key generation (module vs symbol file vs missing build_id). |
| src/Microsoft.SymbolStore/KeyGenerators/WasmFileKeyGenerator.cs | Introduces the Wasm key generator and parsing logic for build_id and .debug_* sections. |
| src/Microsoft.SymbolStore/KeyGenerators/FileKeyGenerator.cs | Adds Wasm detection to the generic file key generator chain. |
Comments suppressed due to low confidence (1)
src/Microsoft.SymbolStore/KeyGenerators/WasmFileKeyGenerator.cs:184
nameStartis assigned but never used here as well; with TreatWarningsAsErrors enabled this breaks the build. Remove the unused local variable.
if (sectionId == CustomSectionId)
{
long nameStart = stream.Position;
string name = ReadWasmString(stream);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| byte[] bytes = new byte[length]; | ||
| int bytesRead = stream.Read(bytes, 0, (int)length); | ||
| if (bytesRead != (int)length) |
| long nameStart = stream.Position; | ||
| string name = ReadWasmString(stream); | ||
| if (name != null && name.StartsWith(".debug_")) |
| // The remainder of the section payload is the build ID | ||
| int buildIdLength = (int)(sectionEnd - stream.Position); | ||
| if (buildIdLength > 0) | ||
| { | ||
| _buildId = new byte[buildIdLength]; |
Adds support for indexing WebAssembly modules on symbol servers by introducing a
WasmFileKeyGeneratorthat parses Wasm binaries and extracts the build_id custom section.This enables uploading and retrieving both halves of split-debug Wasm files. (It follows the same convention as ELF (elf-buildid vs elf-buildid-sym):
Changes:
WasmFileKeyGeneratorclass that validates the Wasm header, scans custom sections for build_id, and detects symbol files via .debug_* sectionsFileKeyGeneratorto includeWasmFileKeyGeneratorin the auto-detection chain