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>2021-06-24 07:54:15 +0300
committerGitHub <noreply@github.com>2021-06-24 07:54:15 +0300
commitfbb3c444bba3086f26c03bca8928307dd4ac6883 (patch)
tree9866e39d8b1df3c2d7a72eeb97fbbf33a1d15182 /symbols
parent0dd5556af12ab8fd053f9072a1f8e80d7a9608a7 (diff)
Add support for reading symbols of modules with multiple codeview debug entries (#770)
Diffstat (limited to 'symbols')
-rw-r--r--symbols/pdb/Mono.Cecil.Pdb/NativePdbReader.cs43
1 files changed, 19 insertions, 24 deletions
diff --git a/symbols/pdb/Mono.Cecil.Pdb/NativePdbReader.cs b/symbols/pdb/Mono.Cecil.Pdb/NativePdbReader.cs
index 2d6b1ba..91f1f3e 100644
--- a/symbols/pdb/Mono.Cecil.Pdb/NativePdbReader.cs
+++ b/symbols/pdb/Mono.Cecil.Pdb/NativePdbReader.cs
@@ -22,7 +22,6 @@ namespace Mono.Cecil.Pdb {
public class NativePdbReader : ISymbolReader {
- int age;
Guid guid;
readonly Disposable<Stream> pdb_file;
@@ -52,13 +51,26 @@ namespace Mono.Cecil.Pdb {
if (!header.HasEntries)
return false;
- var entry = header.GetCodeViewEntry ();
- if (entry == null)
- return false;
+ using (pdb_file) {
+ var info = PdbFile.LoadFunctions (pdb_file.value);
+
+ foreach (var entry in header.Entries) {
+ if (!IsMatchingEntry (info, entry))
+ continue;
+
+ foreach (var function in info.Functions)
+ functions.Add (function.token, function);
- var directory = entry.Directory;
+ return true;
+ }
+ }
+
+ return false;
+ }
- if (directory.Type != ImageDebugType.CodeView)
+ static bool IsMatchingEntry (PdbInfo info, ImageDebugHeaderEntry entry)
+ {
+ if (entry.Directory.Type != ImageDebugType.CodeView)
return false;
var data = entry.Data;
@@ -73,10 +85,7 @@ namespace Mono.Cecil.Pdb {
var guid_bytes = new byte [16];
Buffer.BlockCopy (data, 4, guid_bytes, 0, 16);
- this.guid = new Guid (guid_bytes);
- this.age = ReadInt32 (data, 20);
-
- return PopulateFunctions ();
+ return info.Guid == new Guid (guid_bytes);
}
static int ReadInt32 (byte [] bytes, int start)
@@ -87,20 +96,6 @@ namespace Mono.Cecil.Pdb {
| (bytes [start + 3] << 24));
}
- bool PopulateFunctions ()
- {
- using (pdb_file) {
- var info = PdbFile.LoadFunctions (pdb_file.value);
-
- if (this.guid != info.Guid)
- return false;
-
- foreach (PdbFunction function in info.Functions)
- functions.Add (function.token, function);
- }
-
- return true;
- }
public MethodDebugInformation Read (MethodDefinition method)
{