Browse Source

Fixed callstack browsing; Moved some exception history code

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1255 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
48adfe8ff3
  1. 1
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs
  2. 27
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ExceptionHistoryPad.cs
  3. 1
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/RunningThreadsPad.cs
  4. 69
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  5. 18
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs

1
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs

@ -72,6 +72,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -72,6 +72,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
if (f.HasSymbols) {
if (debuggerCore.SelectedThread != null) {
debuggerCore.SelectedThread.SelectedFunction = f;
debuggerCore.OnDebuggeeStateChanged(); // Force refresh of pads
}
} else {
MessageBox.Show("You can not switch to function without symbols", "Function switch");

27
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ExceptionHistoryPad.cs

@ -10,6 +10,7 @@ using System.Windows.Forms; @@ -10,6 +10,7 @@ using System.Windows.Forms;
using System.Drawing;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;
using ICSharpCode.Core;
@ -23,6 +24,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -23,6 +24,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
{
ListView exceptionHistoryList;
List<Debugger.Exception> exceptions = new List<Debugger.Exception>();
ColumnHeader time = new ColumnHeader();
ColumnHeader exception = new ColumnHeader();
ColumnHeader location = new ColumnHeader();
@ -62,7 +65,16 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -62,7 +65,16 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
protected override void RegisterDebuggerEvents()
{
debugger.ExceptionHistoryModified += delegate { RefreshPad(); };
debuggerCore.ProcessExited += delegate {
exceptions.Clear();
RefreshPad();
};
debuggerCore.DebuggingPaused += delegate (object sender, DebuggingPausedEventArgs e) {
if (e.Reason == PausedReason.Exception) {
exceptions.Add(debuggerCore.SelectedThread.CurrentException);
RefreshPad();
}
};
}
void ExceptionHistoryListItemActivate(object sender, EventArgs e)
@ -81,17 +93,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -81,17 +93,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
if (content is IPositionable) {
((IPositionable)content).JumpTo((int)nextStatement.StartLine - 1, (int)nextStatement.StartColumn - 1);
}
/*if (content.Control is TextEditorControl) {
IDocument document = ((TextEditorControl)content.Control).Document;
LineSegment line = document.GetLineSegment((int)nextStatement.StartLine - 1);
int offset = line.Offset + (int)nextStatement.StartColumn;
currentLineMarker = new TextMarker(offset, (int)nextStatement.EndColumn - (int)nextStatement.StartColumn, TextMarkerType.SolidBlock, Color.Yellow);
currentLineMarkerParent = document;
currentLineMarkerParent.MarkerStrategy.TextMarker.Add(currentLineMarker);
document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea));
document.CommitUpdate();
}*/
}
}
@ -100,7 +101,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -100,7 +101,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
exceptionHistoryList.BeginUpdate();
exceptionHistoryList.Items.Clear();
foreach(Debugger.Exception exception in debugger.ExceptionHistory) {
foreach(Debugger.Exception exception in exceptions) {
string location;
if (exception.Location != null) {
location = exception.Location.SourceFilename + ":" + exception.Location.StartLine;

1
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/RunningThreadsPad.cs

@ -94,6 +94,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -94,6 +94,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
if (debuggerCore.IsPaused) {
if (debuggerCore.SelectedProcess != null) {
debuggerCore.SelectedProcess.SelectedThread = (Thread)(runningThreadsList.SelectedItems[0].Tag);
debuggerCore.OnDebuggeeStateChanged(); // Force refresh of pads
}
} else {
MessageBox.Show("You can not switch threads while the debugger is running.", "Thread switch");

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

@ -39,21 +39,8 @@ namespace ICSharpCode.SharpDevelop.Services @@ -39,21 +39,8 @@ namespace ICSharpCode.SharpDevelop.Services
Properties properties;
bool isDebuggingCache = false;
bool isProcessRunningCache = false;
bool serviceInitialized = false;
List<Debugger.Exception> exceptionHistory = new List<Debugger.Exception>();
public event EventHandler ExceptionHistoryModified;
protected virtual void OnExceptionHistoryModified()
{
if (ExceptionHistoryModified != null) {
ExceptionHistoryModified(this, EventArgs.Empty);
}
}
public NDebugger DebuggerCore {
get {
return debugger;
@ -71,12 +58,6 @@ namespace ICSharpCode.SharpDevelop.Services @@ -71,12 +58,6 @@ namespace ICSharpCode.SharpDevelop.Services
return serviceInitialized;
}
}
public IList<Debugger.Exception> ExceptionHistory {
get {
return exceptionHistory.AsReadOnly();
}
}
public WindowsDebugger()
{
@ -87,13 +68,13 @@ namespace ICSharpCode.SharpDevelop.Services @@ -87,13 +68,13 @@ namespace ICSharpCode.SharpDevelop.Services
public bool IsDebugging {
get {
return isDebuggingCache;
return serviceInitialized && (debugger.Processes.Count > 0);
}
}
public bool IsProcessRunning {
get {
return isProcessRunningCache;
return IsDebugging && debugger.IsRunning;
}
}
@ -164,15 +145,7 @@ namespace ICSharpCode.SharpDevelop.Services @@ -164,15 +145,7 @@ namespace ICSharpCode.SharpDevelop.Services
}
public event EventHandler DebugStarted;
protected virtual void OnDebugStarted(EventArgs e)
{
if (DebugStarted != null) {
DebugStarted(this, e);
}
}
public event EventHandler DebugStopped;
public event EventHandler IsProcessRunningChanged;
protected virtual void OnIsProcessRunningChanged(EventArgs e)
@ -181,16 +154,6 @@ namespace ICSharpCode.SharpDevelop.Services @@ -181,16 +154,6 @@ namespace ICSharpCode.SharpDevelop.Services
IsProcessRunningChanged(this, e);
}
}
public event EventHandler DebugStopped;
protected virtual void OnDebugStopped(EventArgs e)
{
if (DebugStopped != null) {
DebugStopped(this, e);
}
}
/// <summary>
/// Gets variable of given name.
@ -296,9 +259,6 @@ namespace ICSharpCode.SharpDevelop.Services @@ -296,9 +259,6 @@ namespace ICSharpCode.SharpDevelop.Services
foreach (BreakpointBookmark b in DebuggerService.Breakpoints) {
AddBreakpoint(b);
}
isDebuggingCache = false;
isProcessRunningCache = true;
if (Initialize != null) {
Initialize(this, null);
@ -346,30 +306,26 @@ namespace ICSharpCode.SharpDevelop.Services @@ -346,30 +306,26 @@ namespace ICSharpCode.SharpDevelop.Services
void ProcessStarted(object sender, ProcessEventArgs e)
{
if (debugger.Processes.Count == 1) {
OnDebugStarted(EventArgs.Empty);
isDebuggingCache = true;
isProcessRunningCache = true;
if (DebugStarted != null) {
DebugStarted(this, EventArgs.Empty);
}
}
}
void ProcessExited(object sender, ProcessEventArgs e)
{
if (debugger.Processes.Count == 0) {
exceptionHistory.Clear();
OnDebugStopped(EventArgs.Empty);
isDebuggingCache = false;
isProcessRunningCache = false;
if (DebugStopped != null) {
DebugStopped(this, e);
}
}
}
void DebuggingPaused(object sender, DebuggingPausedEventArgs e)
{
isProcessRunningCache = false;
OnIsProcessRunningChanged(EventArgs.Empty);
if (e.Reason == PausedReason.Exception) {
exceptionHistory.Add(debugger.SelectedThread.CurrentException);
OnExceptionHistoryModified();
if (debugger.SelectedThread.CurrentException.ExceptionType != ExceptionType.DEBUG_EXCEPTION_UNHANDLED) {
// Ignore the exception
e.ResumeDebuggingAfterEvent();
@ -398,7 +354,6 @@ namespace ICSharpCode.SharpDevelop.Services @@ -398,7 +354,6 @@ namespace ICSharpCode.SharpDevelop.Services
void DebuggingResumed(object sender, DebuggerEventArgs e)
{
isProcessRunningCache = true;
if (!debugger.Evaluating) {
DebuggerService.RemoveCurrentLineMarker();
}
@ -410,9 +365,9 @@ namespace ICSharpCode.SharpDevelop.Services @@ -410,9 +365,9 @@ namespace ICSharpCode.SharpDevelop.Services
SourcecodeSegment nextStatement = debugger.NextStatement;
if (nextStatement == null) {
DebuggerService.RemoveCurrentLineMarker();
return;
} else {
DebuggerService.JumpToCurrentLine(nextStatement.SourceFullFilename, nextStatement.StartLine, nextStatement.StartColumn, nextStatement.EndLine, nextStatement.EndColumn);
}
DebuggerService.JumpToCurrentLine(nextStatement.SourceFullFilename, nextStatement.StartLine, nextStatement.StartColumn, nextStatement.EndLine, nextStatement.EndColumn);
}
}
}

18
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs

@ -59,7 +59,8 @@ namespace Debugger @@ -59,7 +59,8 @@ namespace Debugger
}
}
protected virtual void OnDebuggeeStateChanged()
// HACK: should not be public
public virtual void OnDebuggeeStateChanged()
{
TraceMessage ("Debugger event: OnDebuggeeStateChanged (" + PausedReason.ToString() + ")");
if (DebuggeeStateChanged != null) {
@ -115,6 +116,10 @@ namespace Debugger @@ -115,6 +116,10 @@ namespace Debugger
get {
return debugeeState;
}
private set {
debugeeState = value;
OnDebuggeeStateChanged();
}
}
public void AssertPaused()
@ -156,17 +161,14 @@ namespace Debugger @@ -156,17 +161,14 @@ namespace Debugger
internal void Pause()
{
if (PausedReason != PausedReason.EvalComplete) {
DebugeeState = new DebugeeState();
}
OnDebuggingPaused();
// Debugger state is unknown after calling OnDebuggingPaused (it may be resumed)
if (IsPaused) {
if (PausedReason != PausedReason.EvalComplete) {
debugeeState = new DebugeeState();
OnDebuggeeStateChanged();
}
}
if (IsPaused) {
pausedHandle.Set();
}

Loading…
Cancel
Save