From cd45fe4961d08580dcaacabdda406b213b07da3a Mon Sep 17 00:00:00 2001 From: Jb Evain Date: Tue, 16 Apr 2013 18:26:04 +0200 Subject: [PATCH] Check that the mdb guid matches the module guid when reading the symbol file --- symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs b/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs index 2db041965..759f38aa3 100644 --- a/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs +++ b/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs @@ -40,7 +40,7 @@ public class MdbReaderProvider : ISymbolReaderProvider { public ISymbolReader GetSymbolReader (ModuleDefinition module, string fileName) { - return new MdbReader (MonoSymbolFile.ReadSymbolFile (module, fileName)); + return new MdbReader (module, MonoSymbolFile.ReadSymbolFile (module, fileName)); } public ISymbolReader GetSymbolReader (ModuleDefinition module, Stream symbolStream) @@ -51,18 +51,20 @@ public ISymbolReader GetSymbolReader (ModuleDefinition module, Stream symbolStre public class MdbReader : ISymbolReader { + readonly ModuleDefinition module; readonly MonoSymbolFile symbol_file; readonly Dictionary documents; - public MdbReader (MonoSymbolFile symFile) + public MdbReader (ModuleDefinition module, MonoSymbolFile symFile) { - symbol_file = symFile; - documents = new Dictionary (); + this.module = module; + this.symbol_file = symFile; + this.documents = new Dictionary (); } public bool ProcessDebugHeader (ImageDebugDirectory directory, byte [] header) { - return true; + return symbol_file.Guid == module.Mvid; } public void Read (MethodBody body, InstructionMapper mapper)