Skip to content

feat(debug-files): extract embedded Portable PDBs from managed PEs#1163

Open
BYK wants to merge 2 commits into
mainfrom
byk/feat/debug-files-embedded-ppdb
Open

feat(debug-files): extract embedded Portable PDBs from managed PEs#1163
BYK wants to merge 2 commits into
mainfrom
byk/feat/debug-files-embedded-ppdb

Conversation

@BYK

@BYK BYK commented Jul 1, 2026

Copy link
Copy Markdown
Member

What

sentry debug-files upload now automatically extracts a Portable PDB embedded inside a managed .NET PE assembly (debug directory entry type 17, deflate-compressed) and uploads it as a separate <name>.pdb debug file — faithful to legacy sentry-cli's extract_embedded_ppdb.

Consumes the new WASM API from @sentry/symbolic@13.7.0 (bumped from 13.5.0):
ObjectFile.asPe()PeFile.embeddedPpdb() (shipped in getsentry/symbolic#1004).

Why the extraction lives at the prepare stage

A managed PE's debug info lives entirely in its embedded Portable PDB, so the PE object itself typically reports no debug features and is dropped by the feature filter. Extraction therefore happens in prepareDifs (not in buildDifList over already-prepared files), independent of whether the PE passed the filters — mirroring legacy, which extracts from any PE with a debug id.

The standalone extracted PPDB bytes are then run through the same per-object filters as any other file, so it:

  • honors --type portablepdb (a PE excluded by the pe-format filter is still read when portablepdb is wanted),
  • honors feature and --id filters,
  • is size-gated against the server's advertised max file size,
  • dedupes normally (debug id + content hash),
  • and works for PEs found inside scanned .zip archives.

Extraction/decompression errors are swallowed (logged at debug level) so a malformed embed never aborts the scan.

Tests

  • test/lib/dif/embedded-ppdb.test.ts — unit tests for extractEmbeddedPpdb (positive/negative, standalone-PPDB round-trip) against small committed .NET PE fixtures.
  • test/commands/debug-files/upload.test.ts — command-level: dry-run queues the .pdb, --type portablepdb extracts it, --type elf ignores it, PE-without-embed yields nothing, and the PPDB is threaded through to uploadDebugFiles.

Fixtures (embedded-ppdb.dll, pe-no-ppdb.dll) are the small Sentry sample console binaries from symbolic-testutils.

Verified locally: typecheck, lint, test (350 debug-files/dif/scan tests), check:deps, check:fragments all green.

Notes

Managed .NET PE assemblies can carry their Portable PDB debug companion
inline (debug directory entry type 17, deflate-compressed). `debug-files
upload` now extracts that PPDB during scanning and uploads it as a
separate `<name>.pdb` DIF, faithful to legacy sentry-cli's
`extract_embedded_ppdb`.

A managed PE's debug info lives entirely in the embedded PPDB, so the PE
object itself usually has no debug features and is dropped by the feature
filter. Extraction therefore happens at the prepare stage, independent of
the PE's own filtering; the standalone PPDB bytes then flow through the
normal per-object filters, so it honors `--type portablepdb`, feature, and
`--id` filters and is size-gated against the server's max file size.

Consumes `ObjectFile.asPe()` / `PeFile.embeddedPpdb()` from
@sentry/symbolic 13.7.0.
@github-actions github-actions Bot added the risk: high PR risk score: high label Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 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-1163/

Built to branch gh-pages at 2026-07-01 15:40 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 84.21%. Project has 5141 uncovered lines.
✅ Project coverage is 81.5%. Comparing base (base) to head (head).

Files with missing lines (2)
File Patch % Lines
src/lib/dif/scan.ts 82.22% ⚠️ 8 Missing and 3 partials
src/lib/dif/index.ts 91.67% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.49%    81.50%    +0.01%
==========================================
  Files          399       399         —
  Lines        27744     27784       +40
  Branches     18025     18045       +20
==========================================
+ Hits         22609     22643       +34
- Misses        5135      5141        +6
- Partials      1859      1862        +3

Generated by Codecov Action

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

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant