summaryrefslogtreecommitdiff
path: root/external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs
diff options
context:
space:
mode:
Diffstat (limited to 'external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs')
-rw-r--r--external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs19
1 files changed, 14 insertions, 5 deletions
diff --git a/external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs b/external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs
index 2db0419650..2440a6642b 100644
--- a/external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs
+++ b/external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs
@@ -40,7 +40,7 @@ namespace Mono.Cecil.Mdb {
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 @@ namespace Mono.Cecil.Mdb {
public class MdbReader : ISymbolReader {
+ readonly ModuleDefinition module;
readonly MonoSymbolFile symbol_file;
readonly Dictionary<string, Document> documents;
- public MdbReader (MonoSymbolFile symFile)
+ public MdbReader (ModuleDefinition module, MonoSymbolFile symFile)
{
- symbol_file = symFile;
- documents = new Dictionary<string, Document> ();
+ this.module = module;
+ this.symbol_file = symFile;
+ this.documents = new Dictionary<string, Document> ();
}
public bool ProcessDebugHeader (ImageDebugDirectory directory, byte [] header)
{
- return true;
+ return symbol_file.Guid == module.Mvid;
}
public void Read (MethodBody body, InstructionMapper mapper)
@@ -80,7 +82,11 @@ namespace Mono.Cecil.Mdb {
static void ReadLocalVariables (MethodEntry entry, MethodBody body, Scope [] scopes)
{
var locals = entry.GetLocals ();
+
foreach (var local in locals) {
+ if (local.Index < 0 || local.Index >= body.Variables.Count) // Mono 2.6 emits wrong local infos for iterators
+ continue;
+
var variable = body.Variables [local.Index];
variable.Name = local.Name;
@@ -200,6 +206,9 @@ namespace Mono.Cecil.Mdb {
static void ReadLocalVariables (MethodEntry entry, MethodSymbols symbols)
{
foreach (var local in entry.GetLocals ()) {
+ if (local.Index < 0 || local.Index >= symbols.Variables.Count) // Mono 2.6 emits wrong local infos for iterators
+ continue;
+
var variable = symbols.Variables [local.Index];
variable.Name = local.Name;
}