Browse Source

Fix steping for statements.

pull/191/merge
Eusebiu Marcu 15 years ago
parent
commit
620524d2c7
  1. 5
      Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs
  2. 14
      ICSharpCode.Decompiler/CodeMappings.cs

5
Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs

@ -308,7 +308,7 @@ namespace ILSpy.Debugger.Services @@ -308,7 +308,7 @@ namespace ILSpy.Debugger.Services
return null;
} else {
var frame = debuggedProcess.SelectedThread.MostRecentStackFrame;
frame.SourceCodeLine = CurrentLineBookmark.Instance.LineNumber;
frame.SourceCodeLine = map.SourceCodeLine;
frame.ILRanges = map.ToArray();
return frame;
}
@ -833,8 +833,7 @@ namespace ILSpy.Debugger.Services @@ -833,8 +833,7 @@ namespace ILSpy.Debugger.Services
int ilOffset = frame.IP;
int line;
string typeName;
CodeMappingsStorage.GetSourceCodeFromMetadataTokenAndOffset(token, ilOffset, out typeName, out line);
if (typeName != null)
if (CodeMappingsStorage.GetSourceCodeFromMetadataTokenAndOffset(token, ilOffset, out typeName, out line))
DebuggerService.JumpToCurrentLine(typeName, line, 0, line, 0);
}
}

14
ICSharpCode.Decompiler/CodeMappings.cs

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using Decompiler;
using ICSharpCode.Decompiler.Disassembler;
@ -30,7 +31,7 @@ namespace ICSharpCode.Decompiler @@ -30,7 +31,7 @@ namespace ICSharpCode.Decompiler
{
int[] result = new int[2];
result[0] = ILInstructionOffset.From;
result[1] = ILInstructionOffset.To;
result[1] = ILInstructionOffset.To + 1;
return result;
}
@ -92,7 +93,7 @@ namespace ICSharpCode.Decompiler @@ -92,7 +93,7 @@ namespace ICSharpCode.Decompiler
this MethodDefinition method,
ConcurrentDictionary<string, List<MethodMapping>> sourceCodeMappings)
{
// create IL code mappings - used in debugger
// create IL/CSharp code mappings - used in debugger
MethodMapping currentMethodMapping = null;
if (sourceCodeMappings.ContainsKey(method.DeclaringType.FullName)) {
var mapping = sourceCodeMappings[method.DeclaringType.FullName];
@ -154,7 +155,7 @@ namespace ICSharpCode.Decompiler @@ -154,7 +155,7 @@ namespace ICSharpCode.Decompiler
/// <param name="ilOffset">IL offset.</param>
/// <param name="typeName">Type name.</param>
/// <param name="line">Line number.</param>
public static void GetSourceCodeFromMetadataTokenAndOffset(
public static bool GetSourceCodeFromMetadataTokenAndOffset(
this ConcurrentDictionary<string, List<MethodMapping>> codeMappings,
uint token,
int ilOffset,
@ -174,15 +175,20 @@ namespace ICSharpCode.Decompiler @@ -174,15 +175,20 @@ namespace ICSharpCode.Decompiler
(cm.ILInstructionOffset.From == ilOffset && ilOffset == cm.ILInstructionOffset.To)); // for IL
if (codeMapping == null) {
codeMapping = mapping.MethodCodeMappings.Find(cm => (cm.ILInstructionOffset.From >= ilOffset));
if (codeMapping == null) {
codeMapping = mapping.MethodCodeMappings.LastOrDefault();
if (codeMapping == null)
continue;
}
}
typeName = typename;
line = codeMapping.SourceCodeLine;
break;
return true;
}
return false;
}
}
}

Loading…
Cancel
Save