From 42f0c2e1303c4fd3fe442f1e76c08d780755a8aa Mon Sep 17 00:00:00 2001 From: Eusebiu Marcu Date: Sat, 12 Mar 2011 18:55:28 +0200 Subject: [PATCH] fix stepping --- Debugger/Debugger.Core/Options.cs | 2 +- .../Services/Debugger/WindowsDebugger.cs | 16 ++++++++-------- .../Ast/TextOutputFormatter.cs | 17 +++++++++++++---- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Debugger/Debugger.Core/Options.cs b/Debugger/Debugger.Core/Options.cs index d90f0fa7b..b3e29519f 100644 --- a/Debugger/Debugger.Core/Options.cs +++ b/Debugger/Debugger.Core/Options.cs @@ -5,7 +5,7 @@ namespace Debugger { public class Options { - public bool EnableJustMyCode = true; + public bool EnableJustMyCode = false; public bool StepOverNoSymbols = false; public bool StepOverDebuggerAttributes = true; public bool StepOverAllProperties = false; diff --git a/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs b/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs index f8f09b7a3..f6cb21e6c 100644 --- a/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs +++ b/Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs @@ -287,27 +287,27 @@ namespace ILSpy.Debugger.Services // Stepping: - SourceCodeMapping GetNextCodeMapping() + SourceCodeMapping GetCurrentCodeMapping() { if (CurrentLineBookmark.Instance == null) return null; // get the mapped instruction from the current line marker or the next one uint token; - var instruction = CodeMappingsStorage.GetInstructionByTypeAndLine( + return CodeMappingsStorage.GetInstructionByTypeAndLine( CurrentLineBookmark.Instance.Type.FullName, CurrentLineBookmark.Instance.LineNumber, out token); - var val = CodeMappingsStorage[CurrentLineBookmark.Instance.Type.FullName]; - - var mapping = val.Find(m => m.MetadataToken == token); - - return mapping.MemberCodeMappings.FirstOrDefault(s => s.ILInstructionOffset.From == instruction.ILInstructionOffset.From); +// var val = CodeMappingsStorage[CurrentLineBookmark.Instance.Type.FullName]; +// +// var mapping = val.Find(m => m.MetadataToken == token); +// +// return mapping.MemberCodeMappings.FirstOrDefault(s => s.ILInstructionOffset.From == instruction.ILInstructionOffset.From); } StackFrame GetStackFrame() { - var map = GetNextCodeMapping(); + var map = GetCurrentCodeMapping(); if (map == null) { CurrentLineBookmark.Remove(); Continue(); diff --git a/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs b/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs index aa89f8dce..4c4693660 100644 --- a/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs +++ b/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs @@ -132,11 +132,20 @@ namespace ICSharpCode.Decompiler.Ast var n = node.Ancestors.FirstOrDefault(a => a.Annotation() != null); if (n != default(AstType)) { MemberMapping mapping = n.Annotation(); + var map = mapping.MemberCodeMappings.Find(s => s.SourceCodeLine == output.CurrentLine); + foreach (var range in ranges) { - mapping.MemberCodeMappings.Add(new SourceCodeMapping { - ILInstructionOffset = range, - SourceCodeLine = output.CurrentLine - }); + if (map == null) { + mapping.MemberCodeMappings.Add(new SourceCodeMapping { + ILInstructionOffset = range, + SourceCodeLine = output.CurrentLine + }); + } else { + if (map.ILInstructionOffset.From > range.From) + map.ILInstructionOffset.From = range.From; + if (map.ILInstructionOffset.To < range.To) + map.ILInstructionOffset.To = range.To; + } } } }