Browse Source

Fixed SD2-505: Debugger freezes on StackOverflowException

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@667 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
d94907f1da
  1. 3
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs
  2. 7
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs
  3. 28
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs

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

@ -196,6 +196,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -196,6 +196,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
bool showArgumentValues = ShowArgumentValues;
bool showExternalMethods = ShowExternalMethods;
bool lastItemIsExternalMethod = false;
int callstackItems = 0;
callStackList.BeginUpdate();
callStackList.Items.Clear();
@ -253,6 +254,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -253,6 +254,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
item.Tag = f;
item.ForeColor = f.HasSymbols ? Color.Black : Color.Gray;
callStackList.Items.Add(item);
callstackItems++;
if (callstackItems >= 100) break;
}
}
callStackList.EndUpdate();

7
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs

@ -54,13 +54,20 @@ namespace DebuggerLibrary @@ -54,13 +54,20 @@ namespace DebuggerLibrary
}
callstack = "";
int callstackItems = 0;
foreach(Function function in thread.Callstack) {
if (callstackItems >= 100) {
callstack += "...\n";
break;
}
SourcecodeSegment loc = function.NextStatement;
callstack += function.Name + "()";
if (loc != null) {
callstack += " - " + loc.SourceFullFilename + ":" + loc.StartLine + "," + loc.StartColumn;
}
callstack += "\n";
callstackItems++;
}
type = runtimeVariable.Type;

28
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs

@ -185,11 +185,9 @@ namespace DebuggerLibrary @@ -185,11 +185,9 @@ namespace DebuggerLibrary
}
}
public unsafe List<Function> Callstack {
public IEnumerable<Function> Callstack {
get {
List<Function> callstack = new List<Function>();
if (process.IsRunning) return callstack;
if (process.IsRunning) yield break;
ICorDebugChainEnum corChainEnum;
corThread.EnumerateChains(out corChainEnum);
@ -207,23 +205,23 @@ namespace DebuggerLibrary @@ -207,23 +205,23 @@ namespace DebuggerLibrary
ICorDebugFrameEnum corFrameEnum;
corChains[0].EnumerateFrames(out corFrameEnum);
for(;;)
{
while (true) {
uint framesFetched;
ICorDebugFrame[] corFrames = new ICorDebugFrame[1]; // Only one at time
corFrameEnum.Next(1, corFrames, out framesFetched);
if (framesFetched == 0) break; // We are done
Function function = null;
try {
if (corFrames[0] is ICorDebugILFrame) {
callstack.Add(new Function(debugger, (ICorDebugILFrame)corFrames[0]));
function = new Function(debugger, (ICorDebugILFrame)corFrames[0]);
}
} catch (COMException) {
// TODO
};
yield return function;
}
}
} // for(;;)
return callstack;
} // get
} // End of public FunctionCollection Callstack
@ -268,14 +266,16 @@ namespace DebuggerLibrary @@ -268,14 +266,16 @@ namespace DebuggerLibrary
}
}
/// <summary>
/// Returns the most recent function on callstack.
/// Returns null if callstack is empty.
/// </summary>
public Function LastFunction {
get {
List<Function> callstack = Callstack;
if (callstack.Count > 0) {
return Callstack[0];
} else {
return null;
foreach(Function function in Callstack) {
return function;
}
return null;
}
}
}

Loading…
Cancel
Save