Skip to content

feat(node-binding): add external wasm debug info for wasm dwarf debugging#13638

Merged
hardfist merged 3 commits intomainfrom
feat/add-external-debug-info
Apr 8, 2026
Merged

feat(node-binding): add external wasm debug info for wasm dwarf debugging#13638
hardfist merged 3 commits intomainfrom
feat/add-external-debug-info

Conversation

@hardfist
Copy link
Copy Markdown
Contributor

@hardfist hardfist commented Apr 8, 2026

Summary

  • add a helper that writes the WebAssembly external_debug_info custom section into the runtime wasm
  • keep the DWARF data in rspack.wasm32-wasi.debug.wasm while loading the non-debug wasm by default
  • document the convention inline with a reference link near addExternalDebugInfo

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings April 8, 2026 02:43
@github-actions github-actions Bot added team The issue/pr is created by the member of Rspack. release: feature release: feature related release(mr only) labels Apr 8, 2026
@hardfist hardfist changed the title feat(node-binding): add external wasm debug info feat(node-binding): add external wasm debug info for wasm dwarf debugging Apr 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for linking a sidecar wasm debug artifact by writing the WebAssembly external_debug_info custom section into the runtime wasm, so DWARF can remain in rspack.wasm32-wasi.debug.wasm while the non-debug wasm is loaded by default.

Changes:

  • Add addExternalDebugInfo helper script that injects the external_debug_info custom section using llvm-objcopy.
  • Invoke the helper from the node binding build script for the wasm32-wasip1-threads build (non-browser).
  • Update the WASI loader to stop preferring the *.debug.wasm at runtime and instead resolve the runtime wasm via package/local fallback.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
crates/node_binding/scripts/build.js Calls the new helper during wasm builds to embed external_debug_info.
crates/node_binding/scripts/add-external-debug-info.js New helper that encodes the external DWARF URL and injects the custom section via llvm-objcopy.
crates/node_binding/rspack.wasi.cjs Adjusts wasm file resolution logic to load the non-debug wasm by default.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/node_binding/scripts/build.js Outdated
Comment thread crates/node_binding/scripts/add-external-debug-info.js Outdated
Comment thread crates/node_binding/rspack.wasi.cjs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 644eac9517

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/node_binding/scripts/build.js Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 8, 2026

Merging this PR will degrade performance by 1.69%

❌ 1 regressed benchmark
✅ 17 untouched benchmarks
⏩ 19 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation rust@persistent_cache_restore@basic-react-development 26.1 ms 26.5 ms -1.69%

Comparing feat/add-external-debug-info (f3a738c) with main (6783130)

Open in CodSpeed

Footnotes

  1. 19 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

📦 Binary Size-limit

Comparing f3a738c to chore: upgrade node to 24 while releasing (#13639) by harpsealjs

🎉 Size decreased by 8.34KB from 49.35MB to 49.34MB (⬇️0.02%)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

Rsdoctor Bundle Diff Analysis

Found 6 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Change
popular-libs 1.7 MB +41.0 B (0.0%)
react-10k 5.7 MB 0
react-1k 826.9 KB 0
react-5k 2.7 MB 0
rome 984.1 KB 0
ui-components 5.0 MB 0
📋 Detailed Reports (Click to expand)

📁 popular-libs

Path: ../build-tools-performance/cases/popular-libs/dist/rsdoctor-data.json

📌 Baseline Commit: 6783130457 | PR: #13639

Metric Current Baseline Change
📊 Total Size 1.7 MB 1.7 MB +41.0 B (0.0%)
📄 JavaScript 1.7 MB 1.7 MB +41.0 B (0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: popular-libs Bundle Diff

Generated by Rsdoctor GitHub Action

Comment thread crates/node_binding/package.json Outdated
@hardfist hardfist enabled auto-merge (squash) April 8, 2026 03:42
@hardfist hardfist merged commit d59ddff into main Apr 8, 2026
39 checks passed
@hardfist hardfist deleted the feat/add-external-debug-info branch April 8, 2026 03:46
hardfist added a commit that referenced this pull request Apr 9, 2026
…ging (#13638)

* feat(node-binding): add external wasm debug info

* fix(node-binding): prefer local wasm and add debug script

* chore: fix npm script naming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants