string GetFileName(SourcecodeSegment segment) { string fileName = debuggedProcess.NextStatement.Filename; if (!Path.IsPathRooted(fileName)) { fileName = Path.Combine(debuggedProcess.WorkingDirectory, fileName); } return(fileName); }
public bool SetInstructionPointer(string filename, int line, int column) { if (CanSetInstructionPointer(filename, line, column)) { SourcecodeSegment seg = debuggedProcess.SelectedThread.MostRecentStackFrame.SetIP(filename, line, column); return(seg != null); } else { return(false); } }
public void JumpToCurrentLine() { DebuggerService.RemoveCurrentLineMarker(); if (debuggedProcess != null) { SourcecodeSegment nextStatement = debuggedProcess.NextStatement; if (nextStatement != null) { DebuggerService.JumpToCurrentLine(nextStatement.Filename, nextStatement.StartLine, nextStatement.StartColumn, nextStatement.EndLine, nextStatement.EndColumn); } } }
public bool CanSetInstructionPointer(string filename, int line, int column) { if (debuggedProcess != null && debuggedProcess.IsPaused && debuggedProcess.SelectedStackFrame != null) { SourcecodeSegment seg = debuggedProcess.SelectedStackFrame.CanSetIP(filename, line, column); return(seg != null); } else { return(false); } }
public void JumpToCurrentLine() { WorkbenchSingleton.MainForm.Activate(); DebuggerService.RemoveCurrentLineMarker(); if (debuggedProcess != null) { SourcecodeSegment nextStatement = debuggedProcess.NextStatement; if (nextStatement != null) { string fileName = GetFileName(nextStatement); DebuggerService.JumpToCurrentLine(fileName, nextStatement.StartLine, nextStatement.StartColumn, nextStatement.EndLine, nextStatement.EndColumn); } } }
private void SelectFrame(uint threadId, ExpandoObject selectedItem) { if (selectedItem == null) { return; } var thread = Process.Threads.Find(t => t.ID == threadId); if (thread == null) { return; } if (StackSelected != null) { StackSelected(this, EventArgs.Empty); } this.IsSelected = true; dynamic obj = selectedItem; foreach (var frame in thread.Callstack) { if (frame.GetMethodName() == obj.MethodName) { if (!obj.IsRunningStackFrame) { obj.Image = PresentationResourceService.GetImage("Icons.48x48.CurrentFrame").Source; } SourcecodeSegment nextStatement = frame.NextStatement; if (nextStatement != null) { var location = new Location(nextStatement.StartColumn, nextStatement.StartLine); FileService.JumpToFilePosition( nextStatement.Filename, location.Line, location.Column); if (FrameSelected != null) { FrameSelected(this, new FrameSelectedEventArgs(frame, location)); } } break; } } }
void JumpToSourceCode() { if (debuggedProcess == null || debuggedProcess.SelectedThread == null) { return; } SourcecodeSegment nextStatement = debuggedProcess.NextStatement; if (nextStatement != null) { DebuggerService.RemoveCurrentLineMarker(); DebuggerService.JumpToCurrentLine(nextStatement.Filename, nextStatement.StartLine, nextStatement.StartColumn, nextStatement.EndLine, nextStatement.EndColumn); } }
public void Stepping() { StartTest("Stepping.cs"); SourcecodeSegment start = process.SelectedStackFrame.NextStatement; foreach (bool jmcEnabled in new bool[] { true, true, false }) { ObjectDump("Log", "Starting run with JMC=" + jmcEnabled.ToString()); process.SelectedStackFrame.SetIP(start.Filename, start.StartLine + 1, start.StartColumn); process.Options.EnableJustMyCode = jmcEnabled; process.Options.StepOverSingleLineProperties = true; process.Options.StepOverFieldAccessProperties = true; process.SelectedStackFrame.StepInto(); // 42.ToString() Assert.AreEqual("Main", process.SelectedStackFrame.MethodInfo.Name); if (jmcEnabled) { process.SelectedStackFrame.StepInto(); // StepRoot Assert.AreEqual("StepRight", process.SelectedStackFrame.MethodInfo.Name); process.SelectedStackFrame.StepOut(); process.SelectedStackFrame.StepOver(); // Finish the step out Assert.AreEqual("Main", process.SelectedStackFrame.MethodInfo.Name); } else { process.SelectedStackFrame.StepInto(); // StepRoot Assert.AreEqual("Main", process.SelectedStackFrame.MethodInfo.Name); } process.SelectedStackFrame.StepInto(); // Generated default constructor Assert.AreEqual("Target", process.SelectedStackFrame.MethodInfo.Name); process.SelectedStackFrame.StepOut(); process.SelectedStackFrame.StepOver(); // Finish the step out Assert.AreEqual("Main", process.SelectedStackFrame.MethodInfo.Name); process.SelectedStackFrame.StepInto(); // ShortProperty Assert.AreEqual("Main", process.SelectedStackFrame.MethodInfo.Name); // TODO: Does not work for static // process.SelectedStackFrame.StepInto(); // FieldProperty process.SelectedStackFrame.StepOver(); // FieldProperty Assert.AreEqual("Main", process.SelectedStackFrame.MethodInfo.Name); process.SelectedStackFrame.StepInto(); // CatchExcpetion Assert.AreEqual("Main", process.SelectedStackFrame.MethodInfo.Name); if (jmcEnabled) { process.SelectedStackFrame.StepInto(); // ZigZag1 process.SelectedStackFrame.StepOver(); process.SelectedStackFrame.StepOver(); Assert.AreEqual("ZigZag2", process.SelectedStackFrame.MethodInfo.Name); process.SelectedStackFrame.StepInto(); Assert.AreEqual("ZigZag2", process.SelectedStackFrame.MethodInfo.Name); Assert.AreEqual(3, process.SelectedStackFrame.NextStatement.StartColumn); process.SelectedStackFrame.StepOut(); process.SelectedStackFrame.StepOver(); // Finish the step out Assert.AreEqual("Main", process.SelectedStackFrame.MethodInfo.Name); } else { process.SelectedStackFrame.StepInto(); // ZigZag1 Assert.AreEqual("Main", process.SelectedStackFrame.MethodInfo.Name); } process.SelectedStackFrame.StepInto(); // MyEvent Assert.AreEqual("Event2", process.SelectedStackFrame.MethodInfo.Name); process.SelectedStackFrame.StepOut(); Assert.AreEqual("Event4", process.SelectedStackFrame.MethodInfo.Name); process.SelectedStackFrame.StepOut(); process.SelectedStackFrame.StepOver(); // Finish the step out Assert.AreEqual("Main", process.SelectedStackFrame.MethodInfo.Name); } EndTest(); }
internal Breakpoint(NDebugger debugger, SourcecodeSegment sourcecodeSegment, bool enabled) { this.debugger = debugger; this.sourcecodeSegment = sourcecodeSegment; this.enabled = enabled; }
public Breakpoint AddBreakpoint(SourcecodeSegment segment, bool breakpointEnabled) { return(AddBreakpoint(new Breakpoint(this, segment, breakpointEnabled))); }