/// <summary> /// Adds a CodeView entry. /// </summary> /// <param name="pdbPath">Path to the PDB. Shall not be empty.</param> /// <param name="pdbContentId">Unique id of the PDB content.</param> /// <param name="portablePdbVersion">Version of Portable PDB format (e.g. 0x0100 for 1.0), or 0 if the PDB is not portable.</param> /// <param name="age">Age (iteration) of the PDB. Shall be 1 for Portable PDBs.</param> /// <exception cref="ArgumentNullException"><paramref name="pdbPath"/> is null.</exception> /// <exception cref="ArgumentException"><paramref name="pdbPath"/> contains NUL character.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="age"/> is less than 1.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="portablePdbVersion"/> is smaller than 0x0100.</exception> internal void AddCodeViewEntry( string pdbPath, BlobContentId pdbContentId, ushort portablePdbVersion, int age) { if (pdbPath == null) { Throw.ArgumentNull(nameof(pdbPath)); } if (age < 1) { Throw.ArgumentOutOfRange(nameof(age)); } // We allow NUL characters to allow for padding for backward compat purposes. if (pdbPath.Length == 0 || pdbPath.IndexOf('\0') == 0) { Throw.InvalidArgument(SR.ExpectedNonEmptyString, nameof(pdbPath)); } if (portablePdbVersion > 0 && portablePdbVersion < PortablePdbVersions.MinFormatVersion) { Throw.ArgumentOutOfRange(nameof(portablePdbVersion)); } int dataSize = WriteCodeViewData(_dataBuilder, pdbPath, pdbContentId.Guid, age); AddEntry( type: DebugDirectoryEntryType.CodeView, version: (portablePdbVersion == 0) ? 0 : PortablePdbVersions.DebugDirectoryEntryVersion(portablePdbVersion), stamp: pdbContentId.Stamp, dataSize); }
public void AddCodeViewEntry( string pdbPath, BlobContentId pdbContentId, ushort portablePdbVersion) { if (pdbPath == null) { Throw.ArgumentNull(nameof(pdbPath)); } int dataSize = WriteCodeViewData(_dataBuilder, pdbPath, pdbContentId.Guid); AddEntry( type: DebugDirectoryEntryType.CodeView, version: (portablePdbVersion == 0) ? 0 : PortablePdbVersions.DebugDirectoryEntryVersion(portablePdbVersion), stamp: pdbContentId.Stamp, dataSize: dataSize); }