Add cross-platform PDB dumping to ilspycmd - #4197
Open
siegfriedpammer wants to merge 5 commits into
Open
siegfriedpammer wants to merge 5 commits into
siegfriedpammer wants to merge 5 commits into
Conversation
Microsoft.DiaSymReader.Converter.Xml was the only reason the app referenced the DiaSymReader chain, and it dragged the NETStandard.Library 1.6.1 shim set with it: 77 packages in ILSpy's lock file, several of them needing security overrides to keep NuGet audit quiet. The command itself only ever ran on Windows, because the converter reaches into native COM. Nothing is lost that the tooling cannot do without it. ilspycmd prints the metadata tables, and Mono.Cecil's symbol readers - already a dependency, and already what DebugInfoUtils falls back to for a Windows PDB - read both PDB formats in managed code on every OS. Assisted-by: Claude:claude-opus-5:Claude Code
The metadata-table dumper only knew the Cor tables, so the debug metadata a Portable PDB carries had no command-line view at all; the GUI has shown those eight tables for years. Moving the dumper into ILSpyX puts it next to the PDB providers it now needs and makes it available to any host, not just ilspycmd. Two things a user would otherwise trip over: a standalone .pdb is accepted as an input file, and asking an assembly for a debug table resolves the embedded or adjacent PDB instead of reporting an empty table. Reading a debug table without either would silently print nothing at all. The GUI's StateMachineMethod reader moves to a shared extension. Its own copy read the MethodDef column with ReadInt16 and switched to the wide form at ushort.MaxValue rather than 1 << 16, so a large enough method table would have produced negative RIDs. Assisted-by: Claude:claude-opus-5:Claude Code
The Pdb2Xml command that just left the app was the only way to see a PDB's contents, and it was Windows-only. Mono.Cecil's symbol readers cover the Portable and the Windows (native MSF) format in managed code and pick the right one themselves, so a single dump path serves both on every OS. Cecil's object model, rather than raw metadata, is what makes this work for Windows PDBs at all: they have no metadata tables for --dump-table to read. That also settles the split between the two options - --dump-table stays the raw row view of a Portable PDB, --dump-pdb is the decoded one. Neither symbol reader exposes the document list, so the documents are collected from the sequence points that reference them. Assisted-by: Claude:claude-opus-5:Claude Code
PdbDumper reads both Portable and Windows PDBs, but only the Portable path had tests: Mono.Cecil's native PDB writer is COM-only, so the format cannot be produced off Windows. The fixture is compiled here by the in-box C# compiler, which still emits it, and the test asserts the PDB really is the native format before reading anything out of it - otherwise the suite would silently re-cover the Portable path. Assisted-by: Claude:claude-opus-5[1m]:Claude Code
Release builds may optimize away an otherwise unused local even when the PDB still carries local-variable information for active test methods. Assert on a local that survives the Release test assembly so the dump coverage is not tied to optimizer behavior. Assisted-by: OpenCode:openai/gpt-5.5:OpenCode
This branch has not been deployed
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.
Adds ilspycmd support for dumping decoded PDB information and Portable PDB metadata tables, replacing the DEBUG-only Pdb2Xml UI command and removing the DiaSymReader dependency chain.
Validation:
OPENSSL_ENABLE_SHA1_SIGNATURES=1 dotnet test --project ICSharpCode.ILSpyCmd.Tests/ICSharpCode.ILSpyCmd.Tests.csproj --report-trx --filter "FullyQualifiedName~DumpPdbOptionTests|FullyQualifiedName~DumpTableOptionTests"passed, 24 tests.Assisted-by: OpenCode:openai/gpt-5.5:OpenCode