提交 bd753399 编写于 作者: T Tomáš Matoušek 提交者: GitHub

Merge pull request #17770 from tmat/pdbxml

Use PdbToXml from Microsoft.DiaSymReader.Converter.Xml
......@@ -18,6 +18,7 @@
<add key="dotnet.myget.org dotnet-buildtools" value="https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json" />
<add key="dotnet.myget.org symreader" value="https://dotnet.myget.org/F/symreader/api/v3/index.json" />
<add key="dotnet.myget.org symreader-portable" value="https://dotnet.myget.org/F/symreader-portable/api/v3/index.json" />
<add key="dotnet.myget.org symreader-converter" value="https://dotnet.myget.org/F/symreader-converter/api/v3/index.json" />
<add key="dotnet.myget.org interactive-window" value="https://dotnet.myget.org/F/interactive-window/api/v3/index.json" />
<add key="dotnet.myget.org roslyn-master-nightly" value="https://dotnet.myget.org/F/roslyn-master-nightly/api/v3/index.json" />
<add key="dotnet.myget.org devcore" value="https://www.myget.org/F/vs-devcore/api/v3/index.json" />
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.25920.0
VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeAnalysisTest", "src\Compilers\Core\CodeAnalysisTest\CodeAnalysisTest.csproj", "{A4C99B85-765C-4C65-9C2A-BB609AAB09E6}"
EndProject
......@@ -235,8 +235,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResultProvider.Portable", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vbc", "src\Compilers\VisualBasic\vbc\vbc.csproj", "{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pdb2Xml", "src\Tools\Source\Pdb2Xml\Pdb2Xml.csproj", "{CF450DCE-D12B-4A11-8D2D-A7A125372C48}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Setup", "Setup", "{19148439-436F-4CDA-B493-70AF4FFC13E9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Features", "Features", "{2491A9B9-C0A8-49EE-9077-A32DE76E1E94}"
......@@ -792,10 +790,6 @@ Global
{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|Any CPU.Build.0 = Release|Any CPU
{CF450DCE-D12B-4A11-8D2D-A7A125372C48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF450DCE-D12B-4A11-8D2D-A7A125372C48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF450DCE-D12B-4A11-8D2D-A7A125372C48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF450DCE-D12B-4A11-8D2D-A7A125372C48}.Release|Any CPU.Build.0 = Release|Any CPU
{E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Release|Any CPU.ActiveCfg = Release|Any CPU
......@@ -1096,7 +1090,6 @@ Global
{BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6}
{FA0E905D-EC46-466D-B7B2-3B5557F9428C} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6}
{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37}
{CF450DCE-D12B-4A11-8D2D-A7A125372C48} = {64BDF58B-41BA-A19E-0D34-B5FA598403B6}
{19148439-436F-4CDA-B493-70AF4FFC13E9} = {999FBDA2-33DA-4F74-B957-03AC72CCE5EC}
{2491A9B9-C0A8-49EE-9077-A32DE76E1E94} = {999FBDA2-33DA-4F74-B957-03AC72CCE5EC}
{5CA5F70E-0FDB-467B-B22C-3CD5994F0087} = {999FBDA2-33DA-4F74-B957-03AC72CCE5EC}
......
......@@ -21,6 +21,7 @@
<MicrosoftDiagnosticsRuntimeVersion>0.8.31-beta</MicrosoftDiagnosticsRuntimeVersion>
<MicrosoftDiagnosticsTracingTraceEventVersion>1.0.35</MicrosoftDiagnosticsTracingTraceEventVersion>
<MicrosoftDiaSymReaderVersion>1.1.0</MicrosoftDiaSymReaderVersion>
<MicrosoftDiaSymReaderConverterXmlVersion>1.0.0-beta1-61513-01</MicrosoftDiaSymReaderConverterXmlVersion>
<MicrosoftDiaSymReaderNativeVersion>1.5.0</MicrosoftDiaSymReaderNativeVersion>
<MicrosoftDiaSymReaderPortablePdbVersion>1.2.0</MicrosoftDiaSymReaderPortablePdbVersion>
<MicrosoftNETCoreRuntimeCoreCLRVersion>1.1.0</MicrosoftNETCoreRuntimeCoreCLRVersion>
......
......@@ -55,7 +55,6 @@
"Exes\\vbccore\\vbc.exe",
"Exes\\vbi\\vbi.exe",
"Exes\\vbicore\\vbi.exe",
"Exes\\Pdb2Xml\\Pdb2Xml.exe",
"Vsix\\CompilerExtension\\Roslyn.Compilers.Extension.dll",
"Vsix\\Templates\\Roslyn.Templates.dll",
"Vsix\\VisualStudioDiagnosticsWindow\\Roslyn.VisualStudio.DiagnosticsWindow.dll",
......
......@@ -14,6 +14,7 @@
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Microsoft.DiaSymReader.Tools;
using Roslyn.Test.PdbUtilities;
using Roslyn.Test.Utilities;
using Xunit;
......
......@@ -8,6 +8,7 @@ Imports System.Text
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.DiaSymReader.Tools
Imports Roslyn.Test.PdbUtilities
Imports Roslyn.Test.Utilities
......
......@@ -323,6 +323,7 @@ Public Class BuildDevDivInsertionFiles
"Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll",
"Microsoft.CodeAnalysis.Workspaces.dll",
"Microsoft.DiaSymReader.dll",
"Microsoft.DiaSymReader.Converter.Xml.dll",
"Microsoft.DiaSymReader.Native.amd64.dll",
"Microsoft.DiaSymReader.Native.x86.dll",
"Microsoft.DiaSymReader.PortablePdb.dll",
......@@ -832,7 +833,6 @@ Public Class BuildDevDivInsertionFiles
add("Exes\VBCSCompiler\VBCSCompiler.exe.config")
add("Exes\InteractiveHost\InteractiveHost.exe.config")
add("Exes\csi\csi.rsp")
add("Exes\Pdb2Xml\Microsoft.DiaSymReader.PortablePdb.dll")
add("Vsix\Roslyn.Deployment.Full.Next\remoteSymbolSearchUpdateEngine.servicehub.service.json")
add("Vsix\Roslyn.Deployment.Full.Next\snapshotService.servicehub.service.json")
add("Vsix\VisualStudioInteractiveComponents\CSharpInteractive.rsp")
......@@ -860,6 +860,8 @@ Public Class BuildDevDivInsertionFiles
add("UnitTests\EditorServicesTest\Esent.Interop.dll")
add("UnitTests\EditorServicesTest\Moq.dll")
add("UnitTests\EditorServicesTest\Microsoft.CodeAnalysis.Test.Resources.Proprietary.dll")
add("UnitTests\EditorServicesTest\Microsoft.DiaSymReader.PortablePdb.dll")
add("UnitTests\EditorServicesTest\Microsoft.DiaSymReader.Converter.Xml.dll")
add("UnitTests\EditorServicesTest\Microsoft.DiaSymReader.dll")
add("UnitTests\EditorServicesTest\Microsoft.DiaSymReader.Native.amd64.dll")
add("UnitTests\EditorServicesTest\Microsoft.DiaSymReader.Native.x86.dll")
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Runtime.InteropServices;
namespace Roslyn.Test.PdbUtilities
{
[ComImport]
[Guid("997DD0CC-A76F-4c82-8D79-EA87559D27AD")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[ComVisible(false)]
public interface ISymUnmanagedSourceServerModule
{
// returns the source server data for the module
// caller must free using CoTaskMemFree()
[PreserveSig]
unsafe int GetSourceServerData(out int pDataByteCount, out byte* ppData);
}
}
此差异已折叠。
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Roslyn.Test.PdbUtilities
{
[Flags]
public enum PdbToXmlOptions
{
Default = 0,
ThrowOnError = 1 << 1,
ResolveTokens = 1 << 2,
IncludeTokens = 1 << 3,
IncludeMethodSpans = 1 << 4,
ExcludeDocuments = 1 << 5,
ExcludeMethods = 1 << 6,
ExcludeSequencePoints = 1 << 7,
ExcludeScopes = 1 << 8,
ExcludeNamespaces = 1 << 9,
ExcludeAsyncInfo = 1 << 10,
ExcludeCustomDebugInformation = 1 << 11,
IncludeSourceServerInformation = 1 << 12,
}
}
......@@ -34,9 +34,6 @@
<Compile Include="Metadata\MetadataVisualizer.cs" />
<Compile Include="Metadata\MethodILExtensions.cs" />
<Compile Include="Pdb\CustomDebugInfoUtilities.cs" />
<Compile Include="Pdb\ISymUnmanagedSourceServerModule.cs" />
<Compile Include="Pdb\PdbToXml.cs" />
<Compile Include="Pdb\PdbToXmlOptions.cs" />
<Compile Include="Pdb\SymReaderFactory.cs" />
<Compile Include="Pdb\Token2SourceLineExporter.cs" />
<Compile Include="Shared\DateTimeUtilities.cs" />
......
......@@ -14,6 +14,7 @@
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.DiaSymReader;
using Microsoft.DiaSymReader.Tools;
using Roslyn.Test.PdbUtilities;
using Roslyn.Test.Utilities;
using Xunit;
......
......@@ -13,6 +13,7 @@
using Microsoft.CodeAnalysis.Collections;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.DiaSymReader.Tools;
using Roslyn.Test.MetadataUtilities;
using Roslyn.Test.PdbUtilities;
using Roslyn.Test.Utilities;
......
......@@ -15,6 +15,7 @@
using System.Xml.Linq;
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.DiaSymReader.Tools;
using Roslyn.Test.MetadataUtilities;
using Roslyn.Test.PdbUtilities;
using Roslyn.Test.Utilities;
......
......@@ -4,6 +4,7 @@
"Microsoft.CSharp": "4.3.0",
"Microsoft.NETCore.Platforms": "1.1.0",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"Microsoft.DiaSymReader.Converter.Xml": "1.0.0-beta1-61513-01",
"System.Collections.Concurrent": "4.3.0",
"System.Console": "4.3.0",
"System.Diagnostics.Debug": "4.3.0",
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\build\Targets\Settings.props" />
<PropertyGroup>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<PlatformTarget>AnyCPU</PlatformTarget>
<ProjectGuid>{CF450DCE-D12B-4A11-8D2D-A7A125372C48}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Pdb2Xml</RootNamespace>
<AssemblyName>Pdb2Xml</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<Prefer32Bit>false</Prefer32Bit>
<LargeAddressAware>true</LargeAddressAware>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<ItemGroup>
<Compile Include="PdbToXmlApp.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Test\PdbUtilities\PdbUtilities.csproj">
<Project>{afde6bea-5038-4a4a-a88e-dbd2e4088eed}</Project>
<Name>PdbUtilities</Name>
</ProjectReference>
<None Include="project.json" />
</ItemGroup>
<Import Project="..\..\..\..\build\Targets\Imports.targets" />
</Project>
\ No newline at end of file
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Roslyn.Test.PdbUtilities;
internal static class PdbToXmlApp
{
public static int Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Usage: Pdb2Xml <PEFile | DeltaPdb> [<output file>] [/tokens] [/methodSpans] [/delta] [/srcsvr]");
return 1;
}
var argList = new List<string>(args);
bool isDelta = argList.Remove("/delta");
var options = PdbToXmlOptions.ResolveTokens;
if (argList.Remove("/tokens"))
{
options |= PdbToXmlOptions.IncludeTokens;
}
if (argList.Remove("/methodSpans"))
{
options |= PdbToXmlOptions.IncludeMethodSpans;
}
if (argList.Remove("/srcsvr"))
{
options |= PdbToXmlOptions.IncludeSourceServerInformation;
}
string peFile;
string pdbFile;
if (isDelta)
{
peFile = null;
pdbFile = argList[0];
}
else
{
peFile = argList[0];
pdbFile = Path.ChangeExtension(peFile, ".pdb");
}
if (peFile != null && !File.Exists(peFile))
{
Console.WriteLine($"File not found: {peFile}");
return 2;
}
if (!File.Exists(pdbFile))
{
Console.WriteLine($"PDB File not found: {pdbFile}");
return 2;
}
string xmlFile;
if (argList.Count > 1)
{
xmlFile = argList[1];
}
else
{
xmlFile = Path.ChangeExtension(pdbFile, ".xml");
}
if (File.Exists(xmlFile))
{
try
{
File.Delete(xmlFile);
}
catch
{
}
}
try
{
if (isDelta)
{
GenXmlFromDeltaPdb(pdbFile, xmlFile, options);
}
else
{
GenXmlFromPdb(peFile, pdbFile, xmlFile, options);
}
}
catch (Exception e)
{
Console.Error.WriteLine(e.Message);
return e.HResult;
}
Console.WriteLine($"PDB dump written to {xmlFile}");
return 0;
}
public static void GenXmlFromPdb(string exePath, string pdbPath, string outPath, PdbToXmlOptions options)
{
using (var exebits = new FileStream(exePath, FileMode.Open, FileAccess.Read))
{
using (var pdbbits = new FileStream(pdbPath, FileMode.Open, FileAccess.Read))
{
using (var sw = new StreamWriter(outPath, append: false, encoding: Encoding.UTF8))
{
PdbToXmlConverter.ToXml(sw, pdbbits, exebits, options);
}
}
}
}
public static void GenXmlFromDeltaPdb(string pdbPath, string outPath, PdbToXmlOptions options)
{
using (var deltaPdb = new FileStream(pdbPath, FileMode.Open, FileAccess.Read))
{
// There is no easy way to enumerate all method tokens that are present in the PDB.
// So dump the first 255 method tokens (the ones that are not present will be skipped):
File.WriteAllText(outPath, PdbToXmlConverter.DeltaPdbToXml(deltaPdb, Enumerable.Range(0x06000001, 255)));
}
}
}
\ No newline at end of file
{
"dependencies": {
"Microsoft.DiaSymReader": "1.1.0"
},
"frameworks": {
"net46": { }
},
"runtimes": {
"win7": { }
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册