Skip to content

Add symbol-server and debugging integration - #4198

Open
pieroviano wants to merge 3 commits into
icsharpcode:masterfrom
pieroviano:symbol-server
Open

pieroviano wants to merge 3 commits into
icsharpcode:masterfrom
pieroviano:symbol-server

Conversation

@pieroviano

Copy link
Copy Markdown

Link to issue(s) this covers

None; feature proposal.

Problem

ILSpy only finds PDBs next to an assembly or embedded in it, cannot fetch them from symbol servers, cannot show the original sources a PDB points to, and offers nothing to a debugger that wants symbols for code shipped without them.

Solution

  • Client: SymbolLocator resolves PDBs along an _NT_SYMBOL_PATH-style path (flat dirs, symbol stores, HTTP SymSrv/SSQP servers with a local cache). Every candidate is verified against the CodeView id before use; SymbolChecksum header sent for symbols.nuget.org.
  • Host: loopback-only SymbolServerHost serves the open assemblies' PE files, their own PDBs, or portable PDBs generated on demand with embedded decompiled sources, so a debugger can step into code without symbols.
  • Source Link: OriginalSourceProvider returns embedded sources or downloads Source Link documents, checked against the PDB document hash.
  • UI: Symbols options page (symbol path, cache, auto-download off by default, server start/stop/port); context entries "Load Symbols from Symbol Server" and "View Original Source".
  • ilspycmd: --symbol-path, --symbol-cache, --serve-symbols <port>.
  • Not supported: Windows-PDB keys on the host (a generated portable PDB can't satisfy them), compressed .pd_ downloads.
  • Most in need of attention: the loopback HTTP server in SymbolServerHost (request parsing, key normalization) and the LoadedAssembly hook that downloads symbols while an explicitly opened assembly loads (auto-download is off by default).
  • At least one test covering the code changed (ILSpy.Tests/Symbols, ICSharpCode.ILSpyCmd.Tests/SymbolOptionTests; full ILSpy.Tests and ICSharpCode.ILSpyCmd.Tests pass locally on .NET 11 RC1, Windows)

ILSpy only found PDBs next to an assembly or embedded in it. A SymbolLocator
now resolves PDBs along an _NT_SYMBOL_PATH-style path (local stores, flat
directories, HTTP SymSrv/SSQP servers with a local cache), verifying every
candidate against the CodeView id before use. A loopback-only SymbolServerHost
serves the opened assemblies' PE files, their own PDBs, or portable PDBs
generated on demand with embedded decompiled sources, so a debugger can step
into code that ships without symbols. OriginalSourceProvider reads embedded
sources or downloads Source Link documents, checking them against the PDB
document hash.
Exposes the ILSpyX symbol support in the app: a Symbols options page drives
the symbol path, cache and auto-download, and starts/stops the loopback
symbol server; assemblies get "Load Symbols from Symbol Server" and members
"View Original Source" (embedded or Source Link). The symbol store now takes
plain modules so hosts without an AssemblyList can serve symbols too.
Lets the CLI find PDBs on symbol servers when decompiling, and run the same
loopback symbol server as the UI for scripted debugging sessions.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant