An open API service indexing awesome lists of open source software.

https://github.com/dotnet/symreader-converter

Converts between Windows PDB and Portable PDB formats.
https://github.com/dotnet/symreader-converter

converter crossplatform debugging managed pdb portable-pdb windows-pdb

Last synced: about 2 months ago
JSON representation

Converts between Windows PDB and Portable PDB formats.

Awesome Lists containing this project

README

        

# Microsoft.DiaSymReader.Converter

Converts between Windows PDB and [Portable PDB](https://github.com/dotnet/core/blob/master/Documentation/diagnostics/portable_pdb.md) formats.

Pre-release builds are available from Azure DevOps public feed: `https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json` ([browse](https://dev.azure.com/dnceng/public/_packaging?_a=feed&feed=dotnet-tools)).

## Usage

The converter is available as a command line tool as well as a library. Both are distributed as NuGet packages.

### [Pdb2Pdb](https://dotnet.myget.org/feed/symreader-converter/package/nuget/Pdb2Pdb)

`Pdb2Pdb.exe [/pdb ] [/out ] [/extract]`

| Switch | Description |
|:--------------|:--------------------------------------------------------|
| `/pdb ` | Path to the PDB to convert. If not specified explicitly, the PDB referenced by or embedded in the DLL/EXE is used. |
| `/out ` | Output PDB path. |
| `/extract` | Extract PDB embedded in the DLL/EXE. |
| `/sourcelink` | When converting to Windows PDB do not convert SourceLink to `srcsrv` format. By default both SourceLink and srcsrv are included in the converted PDB. |
| `/nowarn *` | Suppress all warnings. All warnings are reported by default. |
| `/nowarn ` | Suppress specified warning. |
| `/srcsvrvar =` | Add specified variable to srcsvr stream. Only applicable when converting to Windows PDB and `/sourcelink` is not specified. |

`/extract` and `/pdb` are mutually exclusive.

Example: Create and build .NET Core Standard library and convert its Portable PDB to Windows PDB to be published to Symbol Store.

```
> dotnet new classlib
> dotnet build
> cd bin\Debug\netstandard2.0
> mkdir SymStore
> Pdb2Pdb MyProject.dll /out SymStore\MyProject.pdb
```

### [Microsoft.DiaSymReader.Converter](https://dotnet.myget.org/feed/symreader-converter/package/nuget/Microsoft.DiaSymReader.Converter)

The package provides the following public APIs:

```C#

namespace Microsoft.DiaSymReader.Tools
{
public class PdbConverter
{
///
/// An instance of with no diagnostic reporting.
///
public static PdbConverter Default { get; }

///
/// Creates PDB converter with an optional callback invoked whenever a diagnostic is to be reported.
///
public PdbConverter(Action diagnosticReporter = null);

///
/// Checks whether given PDB stream has Portable format.
///
/// Stream.
/// Returns true if the given stream starts with a Portable PDB signature.
/// does not support read and seek operations.
/// is null.
/// IO error while reading from or writing to a stream.
/// Stream has been disposed while reading.
public static bool IsPortable(Stream pdbStream);

///
/// Converts Windows PDB stream to Portable PDB.
///
/// PE image stream (.dll or .exe)
/// Source stream of Windows PDB data. Must be readable.
/// Target stream of Portable PDB data. Must be writable.
/// , , or is null.
/// does not support read and seek operations.
/// does not support reading.
/// does not support writing.
/// The format of the PE image or the source PDB image is invalid.
/// The PDB doesn't match the CodeView Debug Directory record in the PE image.
/// IO error while reading from or writing to a stream.
/// Stream has been disposed while reading/writing.
public void ConvertWindowsToPortable(Stream peStream, Stream sourcePdbStream, Stream targetPdbStream);

///
/// Converts Windows PDB stream to Portable PDB.
///
/// PE image stream (.dll or .exe)
/// Source stream of Windows PDB data. Must be readable.
/// Target stream of Portable PDB data. Must be writable.
/// , , or is null.
/// does not support reading.
/// does not support writing.
/// The format of the PE image or the PDB stream is invalid.
/// The PDB doesn't match the CodeView Debug Directory record in the PE image.
/// IO error while reading from or writing to a stream.
/// Stream has been disposed while reading/writing.
public void ConvertWindowsToPortable(PEReader peReader, Stream sourcePdbStream, Stream targetPdbStream);

///
/// Converts Portable PDB stream to Windows PDB.
///
/// PE image stream (.dll or .exe)
/// Source stream of Portable PDB data. Must be readable.
/// Target stream of Windows PDB data. Must be writable.
/// Conversion options.
/// , , or is null.
/// does not support read and seek operations.
/// does not support reading.
/// does not support writing.
/// The format of the PE image or the source PDB image is invalid.
/// The PDB doesn't match the CodeView Debug Directory record in the PE image.
/// IO error while reading from or writing to a stream.
/// Stream has been disposed while reading/writing.
public void ConvertPortableToWindows(Stream peStream, Stream sourcePdbStream, Stream targetPdbStream, PortablePdbConversionOptions options = null);

///
/// Converts Portable PDB stream to Windows PDB.
///
/// PE reader.
/// Source stream of Portable PDB data. Must be readable.
/// Target stream of Windows PDB data. Must be writable.
/// Conversion options.
/// , , or is null.
/// does not support reading.
/// does not support writing.
/// The format of the PE image or the source PDB image is invalid.
/// The PDB doesn't match the CodeView Debug Directory record in the PE image.
/// IO error while reading from or writing to a stream.
/// Stream has been disposed while reading/writing.
public void ConvertPortableToWindows(PEReader peReader, Stream sourcePdbStream, Stream targetPdbStream, PortablePdbConversionOptions options = null);

///
/// Converts Portable PDB to Windows PDB.
///
/// PE reader.
/// Portable PDB reader.
/// Target stream of Windows PDB data. Must be writable.
/// Conversion options.
/// , , or is null.
/// does not support writing.
/// The format of the PE image or the source PDB image is invalid.
/// The PDB doesn't match the CodeView Debug Directory record in the PE image.
/// IO error while reading from or writing to a stream.
/// Stream has been disposed while reading/writing.
public void ConvertPortableToWindows(PEReader peReader, MetadataReader pdbReader, Stream targetPdbStream, PortablePdbConversionOptions options = null);

///
/// Converts Portable PDB stream to Windows PDB.
///
/// PE reader.
/// Portable PDB reader.
/// PDB writer.
/// Conversion options.
/// , , or is null.
/// The format of the PE image or the source PDB image is invalid.
/// The PDB doesn't match the CodeView Debug Directory record in the PE image.
/// IO error while reading from or writing to a stream.
public void ConvertPortableToWindows(PEReader peReader, MetadataReader pdbReader, SymUnmanagedWriter pdbWriter, PortablePdbConversionOptions options = null);
}
}

```

## Repository status

[//]: # (Begin current test results)

| | x64 Debug|x64 Release|
|:--:|:--:|:--:|
|**Windows**|[![Build Status](https://ci2.dot.net/job/dotnet_symreader-converter/job/main/job/Windows_NT_Debug/badge/icon)](https://ci2.dot.net/job/dotnet_symreader-converter/job/main/job/Windows_NT_Debug/)|[![Build Status](https://ci2.dot.net/job/dotnet_symreader-converter/job/main/job/Windows_NT_Release/badge/icon)](https://ci2.dot.net/job/dotnet_symreader-converter/job/main/job/Windows_NT_Release/)|

[//]: # (End current test results)