Browse Source

Added methods for "Set current statement" to IDebugger

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@724 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
0432df8966
  1. 9
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/SetCurrentStatementCommand.cs
  2. 20
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  3. 11
      src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs
  4. 12
      src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs

9
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/SetCurrentStatementCommand.cs

@ -18,14 +18,9 @@ namespace ICSharpCode.SharpDevelop.Services @@ -18,14 +18,9 @@ namespace ICSharpCode.SharpDevelop.Services
public override void Run()
{
SharpDevelopTextAreaControl textEditor = this.Owner as SharpDevelopTextAreaControl;
if (textEditor == null) return;
if (textEditor == null || DebuggerService.CurrentDebugger == null) return;
WindowsDebugger debugger = (WindowsDebugger)DebuggerService.CurrentDebugger;
string fileName = textEditor.FileName;
int line = textEditor.ActiveTextAreaControl.Caret.Line + 1;
int column = textEditor.ActiveTextAreaControl.Caret.Column;
debugger.DebuggerCore.CurrentThread.CurrentFunction.SetIP(fileName, line, column);
DebuggerService.CurrentDebugger.SetInstructionPointer(textEditor.FileName, textEditor.ActiveTextAreaControl.Caret.Line + 1, textEditor.ActiveTextAreaControl.Caret.Column);
}
}
}

20
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -259,6 +259,26 @@ namespace ICSharpCode.SharpDevelop.Services @@ -259,6 +259,26 @@ namespace ICSharpCode.SharpDevelop.Services
}
}
public bool CanSetInstructionPointer(string filename, int line, int column)
{
if (debugger != null && debugger.IsPaused && debugger.CurrentFunction != null) {
SourcecodeSegment seg = debugger.CurrentFunction.CanSetIP(filename, line, column);
return seg != null;
} else {
return false;
}
}
public bool SetInstructionPointer(string filename, int line, int column)
{
if (CanSetInstructionPointer(filename, line, column)) {
SourcecodeSegment seg = debugger.CurrentFunction.SetIP(filename, line, column);
return seg != null;
} else {
return false;
}
}
public void Dispose()
{
Stop();

11
src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs

@ -122,6 +122,17 @@ namespace ICSharpCode.Core @@ -122,6 +122,17 @@ namespace ICSharpCode.Core
return null;
}
public bool CanSetInstructionPointer(string filename, int line, int column)
{
return false;
}
public bool SetInstructionPointer(string filename, int line, int column)
{
return false;
}
public event EventHandler DebugStarted;
protected virtual void OnDebugStarted(EventArgs e)

12
src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs

@ -67,6 +67,18 @@ namespace ICSharpCode.Core @@ -67,6 +67,18 @@ namespace ICSharpCode.Core
/// </summary>
DebuggerGridControl GetTooltipControl(string variable);
/// <summary>
/// Queries the debugger whether it is possible to set the instruction pointer to a given position.
/// </summary>
/// <returns>True if possible. False otherwise</returns>
bool CanSetInstructionPointer(string filename, int line, int column);
/// <summary>
/// Set the instruction pointer to a given position.
/// </summary>
/// <returns>True if successful. False otherwise</returns>
bool SetInstructionPointer(string filename, int line, int column);
/// <summary>
/// Ocurrs after the debugger has started.
/// </summary>

Loading…
Cancel
Save