Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/cecil.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJb Evain <jb@evain.net>2019-08-30 00:44:39 +0300
committerGitHub <noreply@github.com>2019-08-30 00:44:39 +0300
commit104b797cc69bcbc3eb36b68f5d0a9ec68b537d24 (patch)
tree0d379b717f71fbc79c7966f617a2b10fe0ef196f /symbols
parent12da1bf7e0e10278e05eeb23adfc72760bbb6668 (diff)
Update to the MIT licensed CCI from github.com/microsoft/cci (#615)
Diffstat (limited to 'symbols')
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/BitAccess.cs16
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/BitSet.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/CvInfo.cs30
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/DataStream.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/DbiDbgHdr.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/DbiHeader.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/DbiModuleInfo.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/DbiSecCon.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/IntHashTable.cs27
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/LICENSE35
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/MsfDirectory.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbConstant.cs22
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbDebugException.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbException.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbFile.cs131
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbFileHeader.cs55
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbFunction.cs116
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbInfo.cs45
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbLine.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbLines.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbReader.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbScope.cs20
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbSlot.cs19
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbSource.cs17
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/PdbTokenLine.cs11
-rw-r--r--symbols/pdb/Microsoft.Cci.Pdb/SourceLocationProvider.cs13
-rw-r--r--symbols/pdb/Mono.Cecil.Pdb/NativePdbReader.cs11
27 files changed, 348 insertions, 352 deletions
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/BitAccess.cs b/symbols/pdb/Microsoft.Cci.Pdb/BitAccess.cs
index d92a5b7..fce6373 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/BitAccess.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/BitAccess.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
using System.IO;
using System.Text;
@@ -19,6 +12,11 @@ namespace Microsoft.Cci.Pdb {
this.buffer = new byte[capacity];
}
+ internal BitAccess(byte[] buffer) {
+ this.buffer = buffer;
+ offset = 0;
+ }
+
internal byte[] Buffer {
get { return buffer; }
}
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/BitSet.cs b/symbols/pdb/Microsoft.Cci.Pdb/BitSet.cs
index 6719131..2a6dff2 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/BitSet.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/BitSet.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/CvInfo.cs b/symbols/pdb/Microsoft.Cci.Pdb/CvInfo.cs
index 49c51ce..153201c 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/CvInfo.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/CvInfo.cs
@@ -1,32 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
-//
-// File: CvInfo.cs
-//
-// Generic CodeView information definitions
-//
-// Structures, constants, etc. for accessing and interpreting
-// CodeView information.
-//
-// The master copy of this file resides in the langapi project (in C++).
-// All Microsoft projects are required to use the master copy without
-// modification. Modification of the master version or a copy
-// without consultation with all parties concerned is extremely
-// risky.
-//
-// When this file is modified, the corresponding documentation file
-// omfdeb.doc in the langapi project must be updated.
-//
-// This is a read-only copy of the C++ file converted to C#.
-//
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/DataStream.cs b/symbols/pdb/Microsoft.Cci.Pdb/DataStream.cs
index 48a1851..8f7ab4b 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/DataStream.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/DataStream.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
using System.IO;
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/DbiDbgHdr.cs b/symbols/pdb/Microsoft.Cci.Pdb/DbiDbgHdr.cs
index 588f3c1..354925d 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/DbiDbgHdr.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/DbiDbgHdr.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/DbiHeader.cs b/symbols/pdb/Microsoft.Cci.Pdb/DbiHeader.cs
index 0ca7915..a245104 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/DbiHeader.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/DbiHeader.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/DbiModuleInfo.cs b/symbols/pdb/Microsoft.Cci.Pdb/DbiModuleInfo.cs
index 8ab3717..1617621 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/DbiModuleInfo.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/DbiModuleInfo.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/DbiSecCon.cs b/symbols/pdb/Microsoft.Cci.Pdb/DbiSecCon.cs
index de9fde9..7730296 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/DbiSecCon.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/DbiSecCon.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/IntHashTable.cs b/symbols/pdb/Microsoft.Cci.Pdb/IntHashTable.cs
index db0e41b..221c07f 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/IntHashTable.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/IntHashTable.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
using System.Collections;
@@ -114,14 +107,14 @@ namespace Microsoft.Cci.Pdb {
*/
// A typical resize algorithm would pick the smallest prime number in this array
- // that is larger than twice the previous capacity.
- // Suppose our Hashtable currently has capacity x and enough elements are added
- // such that a resize needs to occur. Resizing first computes 2x then finds the
- // first prime in the table greater than 2x, i.e. if primes are ordered
- // p_1, p_2, …, p_i,…, it finds p_n such that p_n-1 < 2x < p_n.
- // Doubling is important for preserving the asymptotic complexity of the
- // hashtable operations such as add. Having a prime guarantees that double
- // hashing does not lead to infinite loops. IE, your hash function will be
+ // that is larger than twice the previous capacity.
+ // Suppose our Hashtable currently has capacity x and enough elements are added
+ // such that a resize needs to occur. Resizing first computes 2x then finds the
+ // first prime in the table greater than 2x, i.e. if primes are ordered
+ // p_1, p_2, …, p_i,…, it finds p_n such that p_n-1 < 2x < p_n.
+ // Doubling is important for preserving the asymptotic complexity of the
+ // hashtable operations such as add. Having a prime guarantees that double
+ // hashing does not lead to infinite loops. IE, your hash function will be
// h1(key) + i*h2(key), 0 <= i < size. h2 and the size must be relatively prime.
private static readonly int[] primes = {
3, 7, 11, 17, 23, 29, 37, 47, 59, 71, 89, 107, 131, 163, 197, 239, 293, 353, 431, 521, 631, 761, 919,
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/LICENSE b/symbols/pdb/Microsoft.Cci.Pdb/LICENSE
index 7bfc997..f54f08d 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/LICENSE
+++ b/symbols/pdb/Microsoft.Cci.Pdb/LICENSE
@@ -1,22 +1,21 @@
-Microsoft Public License (Ms-PL)
+The MIT License (MIT)
-This license governs use of the accompanying software. If you use the software, you
-accept this license. If you do not accept the license, do not use the software.
+Copyright (c) Microsoft
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution" have the
-same meaning here as under U.S. copyright law.
-A "contribution" is the original software, or any additions or changes to the software.
-A "contributor" is any person that distributes its contribution under this license.
-"Licensed patents" are a contributor's patent claims that read directly on its contribution.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
-(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/MsfDirectory.cs b/symbols/pdb/Microsoft.Cci.Pdb/MsfDirectory.cs
index a6669b5..875c97e 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/MsfDirectory.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/MsfDirectory.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbConstant.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbConstant.cs
index 434841b..833d849 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbConstant.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbConstant.cs
@@ -1,22 +1,22 @@
-//-----------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
using System.Runtime.InteropServices;
namespace Microsoft.Cci.Pdb {
+ /// <summary />
internal class PdbConstant {
internal string name;
internal uint token;
internal object value;
+ internal PdbConstant(string name, uint token, object value) {
+ this.name = name;
+ this.token = token;
+ this.value = value;
+ }
+
internal PdbConstant(BitAccess bits) {
bits.ReadUInt32(out this.token);
byte tag1;
@@ -78,7 +78,7 @@ namespace Microsoft.Cci.Pdb {
break;
default:
//TODO: error
- break;
+ break;
}
} else {
//TODO: error
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbDebugException.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbDebugException.cs
index d7f8f0f..43ada45 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbDebugException.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbDebugException.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
using System.IO;
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbException.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbException.cs
index 38d1d56..83c611d 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbException.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbException.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
using System.IO;
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbFile.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbFile.cs
index 9435d6e..35c0d3d 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbFile.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbFile.cs
@@ -1,29 +1,40 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
-using System;
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+using System;
+using System.Collections;
using System.Collections.Generic;
using System.IO;
-using Mono.Cecil.Cil;
namespace Microsoft.Cci.Pdb {
+
internal class PdbFile {
+
+ /// <summary>
+ /// GUID of the Basic source language.
+ /// </summary>
+ private static readonly Guid BasicLanguageGuid = new Guid(974311608, -15764, 4560, 180, 66, 0, 160, 36, 74, 29, 210);
+
private PdbFile() // This class can't be instantiated.
{
}
- static void LoadGuidStream(BitAccess bits, out Guid doctype, out Guid language, out Guid vendor) {
+ static void LoadInjectedSourceInformation(BitAccess bits, out Guid doctype, out Guid language, out Guid vendor, out Guid checksumAlgo, out byte[] checksum) {
+ int checksumSize;
+ int injectedSourceSize;
+ checksum = null;
+
bits.ReadGuid(out language);
bits.ReadGuid(out vendor);
bits.ReadGuid(out doctype);
+ bits.ReadGuid(out checksumAlgo);
+ bits.ReadInt32(out checksumSize);
+ bits.ReadInt32(out injectedSourceSize);
+
+ if (checksumSize > 0) {
+ checksum = new byte[checksumSize];
+ bits.ReadBytes(checksum);
+ }
}
static Dictionary<string, int> LoadNameIndex(BitAccess bits, out int age, out Guid guid) {
@@ -131,11 +142,11 @@ namespace Microsoft.Cci.Pdb {
return ht;
}
+ private static PdbFunction match = new PdbFunction();
+
private static int FindFunction(PdbFunction[] funcs, ushort sec, uint off) {
- var match = new PdbFunction {
- segment = sec,
- address = off,
- };
+ match.segment = sec;
+ match.address = off;
return Array.BinarySearch(funcs, match, PdbFunction.byAddress);
}
@@ -146,11 +157,13 @@ namespace Microsoft.Cci.Pdb {
MsfDirectory dir,
Dictionary<string, int> nameIndex,
PdbReader reader,
- uint limit) {
+ uint limit,
+ Dictionary<string, PdbSource> sourceCache)
+ {
Array.Sort(funcs, PdbFunction.byAddressAndToken);
int begin = bits.Position;
- IntHashTable checks = ReadSourceFileInfo(bits, limit, names, dir, nameIndex, reader);
+ IntHashTable checks = ReadSourceFileInfo(bits, limit, names, dir, nameIndex, reader, sourceCache);
// Read the lines next.
bits.Position = begin;
@@ -213,6 +226,11 @@ namespace Microsoft.Cci.Pdb {
bits.ReadUInt32(out file.linsiz); // Size of payload.
PdbSource src = (PdbSource)checks[(int)file.index];
+ if (src.language.Equals(BasicLanguageGuid))
+ {
+ func.AdjustVisualBasicScopes();
+ }
+
PdbLines tmp = new PdbLines(src, file.count);
func.lines[block++] = tmp;
PdbLine[] lines = tmp.lines;
@@ -258,7 +276,9 @@ namespace Microsoft.Cci.Pdb {
bool readStrings,
MsfDirectory dir,
Dictionary<string, int> nameIndex,
- PdbReader reader) {
+ PdbReader reader,
+ Dictionary<string, PdbSource> sourceCache)
+ {
PdbFunction[] funcs = null;
bits.Position = 0;
@@ -276,7 +296,8 @@ namespace Microsoft.Cci.Pdb {
if (funcs != null) {
bits.Position = info.cbSyms + info.cbOldLines;
LoadManagedLines(funcs, names, bits, dir, nameIndex, reader,
- (uint)(info.cbSyms + info.cbOldLines + info.cbLines));
+ (uint)(info.cbSyms + info.cbOldLines + info.cbLines),
+ sourceCache);
for (int i = 0; i < funcs.Length; i++) {
funcList.Add(funcs[i]);
@@ -337,32 +358,43 @@ namespace Microsoft.Cci.Pdb {
bits.Position = end;
}
- internal static PdbFunction[] LoadFunctions(Stream read, out Dictionary<uint, PdbTokenLine> tokenToSourceMapping, out string sourceServerData, out int age, out Guid guid) {
- tokenToSourceMapping = new Dictionary<uint, PdbTokenLine>();
- BitAccess bits = new BitAccess(512 * 1024);
+ internal static PdbInfo LoadFunctions(Stream read) {
+ PdbInfo pdbInfo = new PdbInfo();
+
+ pdbInfo.TokenToSourceMapping = new Dictionary<uint, PdbTokenLine>();
+ BitAccess bits = new BitAccess(64 * 1024);
PdbFileHeader head = new PdbFileHeader(read, bits);
PdbReader reader = new PdbReader(read, head.pageSize);
MsfDirectory dir = new MsfDirectory(reader, head, bits);
DbiModuleInfo[] modules = null;
DbiDbgHdr header;
+ Dictionary<string, PdbSource> sourceCache = new Dictionary<string, PdbSource>();
dir.streams[1].Read(reader, bits);
- Dictionary<string, int> nameIndex = LoadNameIndex(bits, out age, out guid);
+ Dictionary<string, int> nameIndex = LoadNameIndex(bits, out pdbInfo.Age, out pdbInfo.Guid);
int nameStream;
if (!nameIndex.TryGetValue("/NAMES", out nameStream)) {
- throw new PdbException("No `name' stream");
+ throw new PdbException("Could not find the '/NAMES' stream: the PDB file may be a public symbol file instead of a private symbol file");
}
dir.streams[nameStream].Read(reader, bits);
IntHashTable names = LoadNameStream(bits);
int srcsrvStream;
if (!nameIndex.TryGetValue("SRCSRV", out srcsrvStream))
- sourceServerData = string.Empty;
+ pdbInfo.SourceServerData = string.Empty;
else {
DataStream dataStream = dir.streams[srcsrvStream];
byte[] bytes = new byte[dataStream.contentSize];
dataStream.Read(reader, bits);
- sourceServerData = bits.ReadBString(bytes.Length);
+ pdbInfo.SourceServerData = bits.ReadBString(bytes.Length);
+ }
+
+ int sourceLinkStream;
+ if (nameIndex.TryGetValue("SOURCELINK", out sourceLinkStream)) {
+ DataStream dataStream = dir.streams[sourceLinkStream];
+ pdbInfo.SourceLinkData = new byte[dataStream.contentSize];
+ dataStream.Read(reader, bits);
+ bits.ReadBytes(pdbInfo.SourceLinkData);
}
dir.streams[3].Read(reader, bits);
@@ -376,10 +408,10 @@ namespace Microsoft.Cci.Pdb {
if (module.stream > 0) {
dir.streams[module.stream].Read(reader, bits);
if (module.moduleName == "TokenSourceLineInfo") {
- LoadTokenToSourceInfo(bits, module, names, dir, nameIndex, reader, tokenToSourceMapping);
+ LoadTokenToSourceInfo(bits, module, names, dir, nameIndex, reader, pdbInfo.TokenToSourceMapping, sourceCache);
continue;
}
- LoadFuncsFromDbiModule(bits, module, names, funcList, true, dir, nameIndex, reader);
+ LoadFuncsFromDbiModule(bits, module, names, funcList, true, dir, nameIndex, reader, sourceCache);
}
}
}
@@ -400,11 +432,12 @@ namespace Microsoft.Cci.Pdb {
//
Array.Sort(funcs, PdbFunction.byAddressAndToken);
//Array.Sort(funcs, PdbFunction.byToken);
- return funcs;
+ pdbInfo.Functions = funcs;
+ return pdbInfo;
}
private static void LoadTokenToSourceInfo(BitAccess bits, DbiModuleInfo module, IntHashTable names, MsfDirectory dir,
- Dictionary<string, int> nameIndex, PdbReader reader, Dictionary<uint, PdbTokenLine> tokenToSourceMapping) {
+ Dictionary<string, int> nameIndex, PdbReader reader, Dictionary<uint, PdbTokenLine> tokenToSourceMapping, Dictionary<string,PdbSource> sourceCache) {
bits.Position = 0;
int sig;
bits.ReadInt32(out sig);
@@ -477,15 +510,18 @@ namespace Microsoft.Cci.Pdb {
bits.Position = module.cbSyms + module.cbOldLines;
int limit = module.cbSyms + module.cbOldLines + module.cbLines;
- IntHashTable sourceFiles = ReadSourceFileInfo(bits, (uint)limit, names, dir, nameIndex, reader);
+ IntHashTable sourceFiles = ReadSourceFileInfo(bits, (uint)limit, names, dir, nameIndex, reader, sourceCache);
foreach (var tokenLine in tokenToSourceMapping.Values) {
tokenLine.sourceFile = (PdbSource)sourceFiles[(int)tokenLine.file_id];
}
}
+ public static readonly Guid SymDocumentType_Text = new Guid(1518771467, 26129, 4563, 189, 42, 0, 0, 248, 8, 73, 189);
+
private static IntHashTable ReadSourceFileInfo(BitAccess bits, uint limit, IntHashTable names, MsfDirectory dir,
- Dictionary<string, int> nameIndex, PdbReader reader) {
+ Dictionary<string, int> nameIndex, PdbReader reader, Dictionary<string, PdbSource> sourceCache)
+ {
IntHashTable checks = new IntHashTable();
int begin = bits.Position;
@@ -508,17 +544,26 @@ namespace Microsoft.Cci.Pdb {
bits.ReadUInt8(out chk.type);
string name = (string)names[(int)chk.name];
- int guidStream;
- Guid doctypeGuid = DocumentType.Text.ToGuid();
- Guid languageGuid = Guid.Empty;
- Guid vendorGuid = Guid.Empty;
- if (nameIndex.TryGetValue("/SRC/FILES/"+name.ToUpperInvariant(), out guidStream)) {
- var guidBits = new BitAccess(0x100);
- dir.streams[guidStream].Read(reader, guidBits);
- LoadGuidStream(guidBits, out doctypeGuid, out languageGuid, out vendorGuid);
- }
- PdbSource src = new PdbSource(/*(uint)ni,*/ name, doctypeGuid, languageGuid, vendorGuid);
+ PdbSource src;
+ if (!sourceCache.TryGetValue(name, out src))
+ {
+ int guidStream;
+ Guid doctypeGuid = SymDocumentType_Text;
+ Guid languageGuid = Guid.Empty;
+ Guid vendorGuid = Guid.Empty;
+ Guid checksumAlgoGuid = Guid.Empty;
+ byte[] checksum = null;
+ if (nameIndex.TryGetValue("/SRC/FILES/" + name.ToUpperInvariant(), out guidStream))
+ {
+ var guidBits = new BitAccess(0x100);
+ dir.streams[guidStream].Read(reader, guidBits);
+ LoadInjectedSourceInformation(guidBits, out doctypeGuid, out languageGuid, out vendorGuid, out checksumAlgoGuid, out checksum);
+ }
+
+ src = new PdbSource(name, doctypeGuid, languageGuid, vendorGuid, checksumAlgoGuid, checksum);
+ sourceCache.Add(name, src);
+ }
checks.Add(ni, src);
bits.Position += chk.len;
bits.Align(4);
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbFileHeader.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbFileHeader.cs
index 0a92038..8204123 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbFileHeader.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbFileHeader.cs
@@ -1,19 +1,20 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
using System.IO;
+using System.Linq;
using System.Text;
namespace Microsoft.Cci.Pdb {
internal class PdbFileHeader {
+ private readonly byte[] windowsPdbMagic = new byte[32] {
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, // "Microsof"
+ 0x74, 0x20, 0x43, 0x2F, 0x43, 0x2B, 0x2B, 0x20, // "t C/C++ "
+ 0x4D, 0x53, 0x46, 0x20, 0x37, 0x2E, 0x30, 0x30, // "MSF 7.00"
+ 0x0D, 0x0A, 0x1A, 0x44, 0x53, 0x00, 0x00, 0x00 // "^^^DS^^^"
+ };
+
//internal PdbFileHeader(int pageSize) {
// this.magic = new byte[32] {
// 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, // "Microsof"
@@ -24,8 +25,6 @@ namespace Microsoft.Cci.Pdb {
// this.pageSize = pageSize;
//}
- const string MAGIC = "Microsoft C/C++ MSF 7.00";
-
internal PdbFileHeader(Stream reader, BitAccess bits) {
bits.MinCapacity(56);
reader.Seek(0, SeekOrigin.Begin);
@@ -39,18 +38,20 @@ namespace Microsoft.Cci.Pdb {
bits.ReadInt32(out this.directorySize); // 44..47
bits.ReadInt32(out this.zero); // 48..51
- if (Magic != MAGIC) {
- throw new InvalidOperationException("Magic is wrong.");
+ if (!this.magic.SequenceEqual(windowsPdbMagic))
+ {
+ throw new PdbException("The PDB file is not recognized as a Windows PDB file");
}
+
int directoryPages = ((((directorySize + pageSize - 1) / pageSize) * 4) + pageSize - 1) / pageSize;
this.directoryRoot = new int[directoryPages];
bits.FillBuffer(reader, directoryPages * 4);
bits.ReadInt32(this.directoryRoot);
}
- string Magic {
- get { return StringFromBytesUTF8(magic, 0, MAGIC.Length); }
- }
+ //internal string Magic {
+ // get { return StringFromBytesUTF8(magic); }
+ //}
//internal void Write(Stream writer, BitAccess bits) {
// bits.MinCapacity(pageSize);
@@ -68,18 +69,18 @@ namespace Microsoft.Cci.Pdb {
//////////////////////////////////////////////////// Helper Functions.
//
- static string StringFromBytesUTF8(byte[] bytes) {
- return StringFromBytesUTF8(bytes, 0, bytes.Length);
- }
+ //internal static string StringFromBytesUTF8(byte[] bytes) {
+ // return StringFromBytesUTF8(bytes, 0, bytes.Length);
+ //}
- static string StringFromBytesUTF8(byte[] bytes, int offset, int length) {
- for (int i = 0; i < length; i++) {
- if (bytes[offset + i] < ' ') {
- length = i;
- }
- }
- return Encoding.UTF8.GetString(bytes, offset, length);
- }
+ //internal static string StringFromBytesUTF8(byte[] bytes, int offset, int length) {
+ // for (int i = 0; i < length; i++) {
+ // if (bytes[offset + i] < ' ') {
+ // length = i;
+ // }
+ // }
+ // return Encoding.UTF8.GetString(bytes, offset, length);
+ //}
////////////////////////////////////////////////////////////// Fields.
//
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbFunction.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbFunction.cs
index b02b97f..affc5ea 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbFunction.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbFunction.cs
@@ -1,17 +1,12 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
using System.Collections;
using System.Collections.Generic;
+#pragma warning disable 1591 // TODO: doc comments
+
namespace Microsoft.Cci.Pdb {
internal class PdbFunction {
static internal readonly Guid msilMetaData = new Guid(0xc6ea3fc9, 0x59b3, 0x49d6, 0xbc, 0x25,
@@ -43,6 +38,13 @@ namespace Microsoft.Cci.Pdb {
internal List<ILocalScope>/*?*/ iteratorScopes;
internal PdbSynchronizationInformation/*?*/ synchronizationInformation;
+ /// <summary>
+ /// Flag saying whether the method has been identified as a product of VB compilation using
+ /// the legacy Windows PDB symbol format, in which case scope ends need to be shifted by 1
+ /// due to different semantics of scope limits in VB and C# compilers.
+ /// </summary>
+ private bool visualBasicScopesAdjusted = false;
+
private static string StripNamespace(string module) {
int li = module.LastIndexOf('.');
if (li > 0) {
@@ -51,6 +53,36 @@ namespace Microsoft.Cci.Pdb {
return module;
}
+ /// <summary>
+ /// When the Windows PDB reader identifies a PdbFunction as having 'Basic' as its source language,
+ /// it calls this method which adjusts all scopes by adding 1 to their lengths to compensate
+ /// for different behavior of VB vs. the C# compiler w.r.t. emission of scope info.
+ /// </summary>
+ internal void AdjustVisualBasicScopes()
+ {
+ if (!visualBasicScopesAdjusted)
+ {
+ visualBasicScopesAdjusted = true;
+
+ // Don't adjust root scope as that one is correct
+ foreach (PdbScope scope in scopes)
+ {
+ AdjustVisualBasicScopes(scope.scopes);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Recursively update the entire scope tree by adding 1 to the length of each scope.
+ /// </summary>
+ private void AdjustVisualBasicScopes(PdbScope[] scopes)
+ {
+ foreach (PdbScope scope in scopes)
+ {
+ scope.length++;
+ AdjustVisualBasicScopes(scope.scopes);
+ }
+ }
internal static PdbFunction[] LoadManagedFunctions(/*string module,*/
BitAccess bits, uint limit,
@@ -260,15 +292,7 @@ namespace Microsoft.Cci.Pdb {
if (oem.idOem == msilMetaData) {
string name = bits.ReadString();
if (name == "MD2") {
- byte version;
- bits.ReadUInt8(out version);
- if (version == 4) {
- byte count;
- bits.ReadUInt8(out count);
- bits.Align(4);
- while (count-- > 0)
- this.ReadCustomMetadata(bits);
- }
+ ReadMD2CustomMetadata(bits);
} else if (name == "asyncMethodInfo") {
this.synchronizationInformation = new PdbSynchronizationInformation(bits);
}
@@ -338,27 +362,47 @@ namespace Microsoft.Cci.Pdb {
}
}
- private void ReadCustomMetadata(BitAccess bits) {
- int savedPosition = bits.Position;
+ internal void ReadMD2CustomMetadata(BitAccess bits)
+ {
byte version;
bits.ReadUInt8(out version);
- if (version != 4) {
- throw new PdbDebugException("Unknown custom metadata item version: {0}", version);
- }
- byte kind;
- bits.ReadUInt8(out kind);
- bits.Align(4);
- uint numberOfBytesInItem;
- bits.ReadUInt32(out numberOfBytesInItem);
- switch (kind) {
- case 0: this.ReadUsingInfo(bits); break;
- case 1: this.ReadForwardInfo(bits); break;
- case 2: break; // this.ReadForwardedToModuleInfo(bits); break;
- case 3: this.ReadIteratorLocals(bits); break;
- case 4: this.ReadForwardIterator(bits); break;
- // TODO: handle unknown custom metadata, 5 & 6 are new with roslyn, see https://roslyn.codeplex.com/workitem/54
+ if (version == 4) {
+ byte count;
+ bits.ReadUInt8(out count);
+ bits.Align(4);
+ while (count-- > 0)
+ this.ReadCustomMetadata(bits);
}
- bits.Position = savedPosition+(int)numberOfBytesInItem;
+ }
+
+ private void ReadCustomMetadata(BitAccess bits)
+ {
+ int savedPosition = bits.Position;
+ byte version;
+ bits.ReadUInt8(out version);
+ byte kind;
+ bits.ReadUInt8(out kind);
+ bits.Position += 2; // 2-bytes padding
+ uint numberOfBytesInItem;
+ bits.ReadUInt32(out numberOfBytesInItem);
+ if (version == 4)
+ {
+ switch (kind)
+ {
+ case 0: this.ReadUsingInfo(bits); break;
+ case 1: this.ReadForwardInfo(bits); break;
+ case 2: break; // this.ReadForwardedToModuleInfo(bits); break;
+ case 3: this.ReadIteratorLocals(bits); break;
+ case 4: this.ReadForwardIterator(bits); break;
+ case 5: break; // dynamic locals - see http://index/#Microsoft.VisualStudio.LanguageServices/Shared/CustomDebugInfoReader.cs,a3031f7681d76e93
+ case 6: break; // EnC data
+ case 7: break; // EnC data for lambdas and closures
+ // ignore any other unknown record types that may be added in future, instead of throwing an exception
+ // see more details here: https://github.com/tmat/roslyn/blob/portable-pdb/docs/specs/PortablePdb-Metadata.md
+ default: break; // throw new PdbDebugException("Unknown custom metadata item kind: {0}", kind);
+ }
+ }
+ bits.Position = savedPosition + (int)numberOfBytesInItem;
}
private void ReadForwardIterator(BitAccess bits) {
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbInfo.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbInfo.cs
new file mode 100644
index 0000000..38a930c
--- /dev/null
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbInfo.cs
@@ -0,0 +1,45 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Collections.Generic;
+
+using Microsoft.Cci.Pdb;
+
+namespace Microsoft.Cci {
+
+ /// <summary>
+ /// This class represents the information read from a PDB file (both legacy Windows and Portable).
+ /// </summary>
+ internal class PdbInfo {
+ /// <summary>
+ /// Enumeration of per-function information contained in the PDB file.
+ /// </summary>
+ public IEnumerable<PdbFunction> Functions;
+
+ /// <summary>
+ /// Mapping from tokens to source files and line numbers.
+ /// </summary>
+ public Dictionary<uint, PdbTokenLine> TokenToSourceMapping;
+
+ /// <summary>
+ /// Source server data information.
+ /// </summary>
+ public string SourceServerData;
+
+ /// <summary>
+ /// Age of the PDB file is used to match the PDB against the PE binary.
+ /// </summary>
+ public int Age;
+
+ /// <summary>
+ /// GUID of the PDB file is used to match the PDB against the PE binary.
+ /// </summary>
+ public Guid Guid;
+
+ /// <summary>
+ /// Source link data information.
+ /// </summary>
+ public byte[] SourceLinkData;
+ }
+}
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbLine.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbLine.cs
index f6fe3a9..5e73677 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbLine.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbLine.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbLines.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbLines.cs
index 382638b..18d8974 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbLines.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbLines.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbReader.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbReader.cs
index edfd926..28d02c1 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbReader.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbReader.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
using System.IO;
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbScope.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbScope.cs
index 92ac385..9dad77b 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbScope.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbScope.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
@@ -22,16 +15,21 @@ namespace Microsoft.Cci.Pdb {
internal uint offset;
internal uint length;
- internal PdbScope(uint address, uint length, PdbSlot[] slots, PdbConstant[] constants, string[] usedNamespaces) {
+ internal PdbScope(uint address, uint offset, uint length, PdbSlot[] slots, PdbConstant[] constants, string[] usedNamespaces) {
this.constants = constants;
this.slots = slots;
this.scopes = new PdbScope[0];
this.usedNamespaces = usedNamespaces;
this.address = address;
- this.offset = 0;
+ this.offset = offset;
this.length = length;
}
+ internal PdbScope(uint address, uint length, PdbSlot[] slots, PdbConstant[] constants, string[] usedNamespaces)
+ : this(address, 0, length, slots, constants, usedNamespaces)
+ {
+ }
+
internal PdbScope(uint funcOffset, BlockSym32 block, BitAccess bits, out uint typind) {
//this.segment = block.seg;
this.address = block.off;
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbSlot.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbSlot.cs
index e2b76d5..b9b8ef7 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbSlot.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbSlot.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
@@ -19,6 +12,14 @@ namespace Microsoft.Cci.Pdb {
//internal uint segment;
//internal uint address;
+ internal PdbSlot(uint slot, uint typeToken, string name, ushort flags)
+ {
+ this.slot = slot;
+ this.typeToken = typeToken;
+ this.name = name;
+ this.flags = flags;
+ }
+
internal PdbSlot(BitAccess bits) {
AttrSlotSym slot;
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbSource.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbSource.cs
index ac40f85..6310b73 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbSource.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbSource.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
@@ -17,13 +10,17 @@ namespace Microsoft.Cci.Pdb {
internal Guid doctype;
internal Guid language;
internal Guid vendor;
+ internal Guid checksumAlgorithm;
+ internal byte[] checksum;
- internal PdbSource(/*uint index, */string name, Guid doctype, Guid language, Guid vendor) {
+ internal PdbSource(/*uint index, */string name, Guid doctype, Guid language, Guid vendor, Guid checksumAlgorithm, byte[] checksum) {
//this.index = index;
this.name = name;
this.doctype = doctype;
this.language = language;
this.vendor = vendor;
+ this.checksumAlgorithm = checksumAlgorithm;
+ this.checksum = checksum;
}
}
}
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/PdbTokenLine.cs b/symbols/pdb/Microsoft.Cci.Pdb/PdbTokenLine.cs
index 879339b..d59c9c8 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/PdbTokenLine.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/PdbTokenLine.cs
@@ -1,13 +1,6 @@
-//-----------------------------------------------------------------------------
-//
// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the Microsoft Public License.
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//-----------------------------------------------------------------------------
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
namespace Microsoft.Cci.Pdb {
diff --git a/symbols/pdb/Microsoft.Cci.Pdb/SourceLocationProvider.cs b/symbols/pdb/Microsoft.Cci.Pdb/SourceLocationProvider.cs
index 1c4da18..4b6b152 100644
--- a/symbols/pdb/Microsoft.Cci.Pdb/SourceLocationProvider.cs
+++ b/symbols/pdb/Microsoft.Cci.Pdb/SourceLocationProvider.cs
@@ -1,14 +1,11 @@
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) Microsoft Corporation. All Rights Reserved.
-//
-//-----------------------------------------------------------------------------
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
using System;
using System.Collections.Generic;
using System.IO;
-using Microsoft.Cci;
-using Microsoft.Cci.Pdb;
-using System.Text;
+
+#pragma warning disable 1591 // TODO: doc comments
namespace Microsoft.Cci {
diff --git a/symbols/pdb/Mono.Cecil.Pdb/NativePdbReader.cs b/symbols/pdb/Mono.Cecil.Pdb/NativePdbReader.cs
index 9280e0f..f3ca8b2 100644
--- a/symbols/pdb/Mono.Cecil.Pdb/NativePdbReader.cs
+++ b/symbols/pdb/Mono.Cecil.Pdb/NativePdbReader.cs
@@ -90,17 +90,12 @@ namespace Mono.Cecil.Pdb {
bool PopulateFunctions ()
{
using (pdb_file) {
- Dictionary<uint, PdbTokenLine> tokenToSourceMapping;
- string sourceServerData;
- int age;
- Guid guid;
+ var info = PdbFile.LoadFunctions (pdb_file.value);
- var funcs = PdbFile.LoadFunctions (pdb_file.value, out tokenToSourceMapping, out sourceServerData, out age, out guid);
-
- if (this.guid != guid)
+ if (this.guid != info.Guid)
return false;
- foreach (PdbFunction function in funcs)
+ foreach (PdbFunction function in info.Functions)
functions.Add (function.token, function);
}