Browse Source

Order and merge the stepping ranges at the end

pull/191/merge
Eusebiu Marcu 15 years ago
parent
commit
8621e93ec1
  1. 2
      Debugger/Debugger.Core/SourcecodeSegment.cs
  2. 9
      Debugger/Debugger.Core/StackFrame.cs
  3. 21
      ICSharpCode.Decompiler/CodeMappings.cs

2
Debugger/Debugger.Core/SourcecodeSegment.cs

@ -383,7 +383,7 @@ namespace Debugger
segment.endColumn = 0; segment.endColumn = 0;
segment.corFunction = corFunction; segment.corFunction = corFunction;
segment.ilStart = offset; segment.ilStart = offset;
segment.ilEnd = ranges[ranges.Length - 1]; segment.ilEnd = ranges[1];
segment.stepRanges = ranges; segment.stepRanges = ranges;
return segment; return segment;

9
Debugger/Debugger.Core/StackFrame.cs

@ -191,13 +191,8 @@ namespace Debugger
void AsyncStep(bool stepIn) void AsyncStep(bool stepIn)
{ {
SourcecodeSegment nextSt = NextStatement;
if (nextSt == null) {
throw new DebuggerException("Unable to step. Next statement not aviable");
}
if (stepIn) { if (stepIn) {
Stepper stepInStepper = Stepper.StepIn(this, nextSt.StepRanges, "normal"); Stepper stepInStepper = Stepper.StepIn(this, ILRanges, "normal");
this.Thread.CurrentStepIn = stepInStepper; this.Thread.CurrentStepIn = stepInStepper;
Stepper clearCurrentStepIn = Stepper.StepOut(this, "clear current step in"); Stepper clearCurrentStepIn = Stepper.StepOut(this, "clear current step in");
clearCurrentStepIn.StepComplete += delegate { clearCurrentStepIn.StepComplete += delegate {
@ -207,7 +202,7 @@ namespace Debugger
}; };
clearCurrentStepIn.Ignore = true; clearCurrentStepIn.Ignore = true;
} else { } else {
Stepper.StepOver(this, nextSt.StepRanges, "normal"); Stepper.StepOver(this, ILRanges, "normal");
} }
AsyncContinue(); AsyncContinue();

21
ICSharpCode.Decompiler/CodeMappings.cs

@ -45,24 +45,19 @@ namespace ICSharpCode.Decompiler
/// <returns></returns> /// <returns></returns>
public int[] ToArray() public int[] ToArray()
{ {
var resultList = new List<int>();
// add list for the current source code line // add list for the current source code line
var currentList = MemberMapping.MemberCodeMappings var currentList = MemberMapping.MemberCodeMappings
.FindAll(m => m.SourceCodeLine == this.SourceCodeLine) .FindAll(m => m.SourceCodeLine == this.SourceCodeLine)
.OrderBy(m => m.ILInstructionOffset.From); .ConvertAll<ILRange>(m => m.ILInstructionOffset);
foreach (var element in currentList.Distinct(new SourceCodeMappingComparer())) {
resultList.Add(element.ILInstructionOffset.From);
resultList.Add(element.ILInstructionOffset.To);
}
// add inverted // add inverted
var invertedList = MemberMapping.GetInvertedList(); currentList.AddRange(MemberMapping.GetInvertedList());
if (invertedList != null && invertedList.Count() > 0) {
foreach (var range in invertedList) { var resultList = new List<int>();
resultList.Add(range.From); foreach (var element in ILRange.OrderAndJoint(currentList)) {
resultList.Add(range.To); resultList.Add(element.From);
} resultList.Add(element.To);
} }
return resultList.ToArray(); return resultList.ToArray();

Loading…
Cancel
Save