diff --git a/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs b/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs index 89c43c54d..afaf323c6 100644 --- a/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs +++ b/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs @@ -282,7 +282,7 @@ namespace ILSpy.Debugger.Services // Stepping: - SourceCodeMapping GetNextCodeMapping() + MethodMapping GetNextCodeMapping() { uint token; var instruction = CodeMappingsStorage.GetInstructionByTypeAndLine( @@ -291,9 +291,9 @@ namespace ILSpy.Debugger.Services var val = CodeMappingsStorage[CurrentLineBookmark.Instance.TypeName]; - var mapping = val.Find(m => m.MetadataToken == token); + return val.Find(m => m.MetadataToken == token); - return mapping.MethodCodeMappings.FirstOrDefault(s => s.ILInstructionOffset.From <= instruction.ILInstructionOffset.To); + //return mapping.MethodCodeMappings.FirstOrDefault(s => s.ILInstructionOffset.From <= instruction.ILInstructionOffset.To); } public void StepInto() @@ -315,8 +315,8 @@ namespace ILSpy.Debugger.Services Continue(); } else { var frame = debuggedProcess.SelectedThread.MostRecentStackFrame; - frame.SourceCodeLine = map.SourceCodeLine; - frame.ILRanges = (new List { map.ILInstructionOffset.From, map.ILInstructionOffset.To }).ToArray(); + frame.SourceCodeLine = CurrentLineBookmark.Instance.LineNumber; + frame.ILRanges = map.ToArray(); frame.AsyncStepInto(); } } @@ -341,8 +341,8 @@ namespace ILSpy.Debugger.Services Continue(); } else { var frame = debuggedProcess.SelectedThread.MostRecentStackFrame; - frame.SourceCodeLine = map.SourceCodeLine; - frame.ILRanges = (new List { map.ILInstructionOffset.From, map.ILInstructionOffset.To }).ToArray(); + frame.SourceCodeLine = CurrentLineBookmark.Instance.LineNumber; + frame.ILRanges = map.ToArray(); frame.AsyncStepOver(); } } @@ -367,8 +367,8 @@ namespace ILSpy.Debugger.Services Continue(); } else { var frame = debuggedProcess.SelectedThread.MostRecentStackFrame; - frame.SourceCodeLine = map.SourceCodeLine; - frame.ILRanges = (new List { map.ILInstructionOffset.From, map.ILInstructionOffset.To }).ToArray(); + frame.SourceCodeLine = CurrentLineBookmark.Instance.LineNumber; + frame.ILRanges = map.ToArray(); frame.AsyncStepOut(); } } diff --git a/ICSharpCode.Decompiler/CodeMappings.cs b/ICSharpCode.Decompiler/CodeMappings.cs index 98582c299..8c41b5951 100644 --- a/ICSharpCode.Decompiler/CodeMappings.cs +++ b/ICSharpCode.Decompiler/CodeMappings.cs @@ -37,6 +37,20 @@ namespace ICSharpCode.Decompiler public uint MetadataToken { get; set; } public List MethodCodeMappings { get; set; } + + public int[] ToArray() + { + int[] result = new int[MethodCodeMappings.Count + 1]; + int i = 0; + foreach (var element in MethodCodeMappings) { + result[i] = MethodCodeMappings[i].ILInstructionOffset.From; + ++i; + } + + result[MethodCodeMappings.Count] = MethodCodeMappings[MethodCodeMappings.Count - 1].ILInstructionOffset.To; + + return result; + } } public static class CodeMappings