ctaggart / SourceLink

Source Code On Demand
MIT License
356 stars 55 forks source link

document symbols in Visual Studio 2017 again #358

Closed ctaggart closed 5 years ago

ctaggart commented 6 years ago

Produce and upload symbols for Windows https://github.com/dotnet/coreclr/issues/10873

By default, the Microsoft System Servers are not enabled

image

because:

The performance of remote symbol stores can vary due to latency, bandwidth, or availability of servers. Debugging performance can be improved by selecting the option to load only specified modules when enabling this server.

image

Without it enabled, performance profiling has issues:

image

Profiling started.
Profiling process ID 27040 (dotnet).
Process ID 27040 has exited.
Data written to C:\Users\taggac\coreservices\VimServiceTest\dotnet180707.vsp.
Profiling finished.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\coreclr.dll.
Failed to load symbols for C:\Program Files\dotnet\dotnet.exe.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.Private.CoreLib.dll.
Failed to load symbols for C:\Users\taggac\coreservices\VimServiceTest\bin\Debug\netcoreapp2.1\VimService.dll.
Failed to load symbols for C:\Users\taggac\.nuget\packages\vmware.vsphere.management\6.5.1-build.62\lib\netstandard2.0\VMware.vSphere.Management.dll.
Failed to load symbols for C:\Users\taggac\.nuget\packages\system.private.servicemodel\4.4.2\runtimes\win7\lib\netstandard2.0\System.Private.ServiceModel.dll.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.Private.Uri.dll.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.Linq.dll.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.ObjectModel.dll.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.Private.Xml.dll.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.Runtime.dll.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.Private.DataContractSerialization.dll.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.Text.RegularExpressions.dll.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.Runtime.Extensions.dll.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.Collections.NonGeneric.dll.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.Diagnostics.TraceSource.dll.
Failed to load symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.Collections.dll.
ctaggart commented 6 years ago

The default symbol cache ends up being %TEMP%\SymbolCache, so you will have a pingme.txt in that folder. The format is pdb file name and then the pdb guid. The pdb guid is embedded in the dll and the portable pdb or windows pdb.

dll

let printDllPdbGuid dll =
    use reader = new PEReader(File.OpenRead dll)
    if reader.HasMetadata then
        let entries = reader.ReadDebugDirectory()
        let codeViewEntry = entries |> Seq.find (fun entry -> entry.Type = DebugDirectoryEntryType.CodeView)
        let codeView = reader.ReadCodeViewDebugDirectoryData codeViewEntry
        printfn "%A" codeView.Guid

portable pdb

let printPdbGuid pdb =
    use mrp = MetadataReaderProvider.FromPortablePdbStream(File.OpenRead(pdb))
    let mr = mrp.GetMetadataReader()
    let id = BlobContentId mr.DebugMetadataHeader.Id
    printfn "pdb guid %s" (id.Guid.ToString("N").ToUpperInvariant())

windows pdb

May need to resurrect some old code:

get the Windows PDB GUID https://github.com/ctaggart/SourceLink/blob/v1.1.0/SourceLink/PdbFile.fs https://github.com/GitTools/GitLink/blob/develop/src/GitLink/Pdb/PdbFile.cs

check signature https://github.com/GitTools/GitLink/pull/177/files

ctaggart commented 6 years ago

The fact that the Visual Studio 2017 15.7.4 Enterprise Performance Profiler still doesn't support portable pdb files is really frustrating.

Improve NuGet package debugging and symbols experience https://github.com/NuGet/Home/issues/6104

NuGet Package Debugging & Symbols Improvements https://github.com/NuGet/Home/wiki/NuGet-Package-Debugging-&-Symbols-Improvements