void Step(bool into) { try { if (stepper != null) { //stepper.IsActive ();//no meaning? CorDebugFrame frame = activeThread.ActiveFrame; var met = frame.Function.GetMethodInfo(this)?.DebugInformation; if (met == null || !met.HasSequencePoints) { RawContinue(into); return; } // Find the current line var range = new COR_DEBUG_STEP_RANGE(); int currentLine = -1; foreach (var sp in met.SequencePoints) { if (sp.Offset > frame.IP) { if (currentLine == -1) { currentLine = sp.StartLine; range.startOffset = frame.IP; range.endOffset = (uint)sp.Offset; } else { if (sp.StartLine == currentLine) { range.endOffset = (uint)sp.Offset; } else { break; } } } } if (currentLine == -1) { RawContinue(into); return; } stepper.StepRange(into, new[] { range }); ClearEvalStatus(); process.Continue(); } } catch (Exception e) { OnDebuggerOutput(true, e.ToString()); } }
void Step(bool into) { try { if (stepper != null) { //stepper.IsActive ();//no meaning? CorDebugFrame frame = activeThread.ActiveFrame; var reader = frame.Function.Assembly.DebugData; if (reader == null) { RawContinue(into); return; } var met = new MethodSymbols(new MetadataToken(frame.Function.Token)); //Ugliest hack ever if (reader is Mono.Cecil.Mdb.MdbReader) { for (int i = 0; i < 100; i++) { met.Variables.Add(new VariableDefinition(null)); } } reader.Read(met); if (met == null || met.Instructions.Count == 0) { RawContinue(into); return; } // Find the current line var range = new COR_DEBUG_STEP_RANGE(); int currentLine = -1; foreach (var sp in met.Instructions) { if (sp.Offset > frame.IP) { if (currentLine == -1) { currentLine = sp.SequencePoint.StartLine; range.startOffset = frame.IP; range.endOffset = (uint)sp.Offset; } else { if (sp.SequencePoint.StartLine == currentLine) { range.endOffset = (uint)sp.Offset; } else { break; } } } } if (currentLine == -1) { RawContinue(into); return; } stepper.StepRange(into, new[] { range }); ClearEvalStatus(); process.Continue(); } } catch (Exception e) { OnDebuggerOutput(true, e.ToString()); } }