Browse Source

Bugfix: Some native methods leaked into callstack

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1292 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
22f86ac9de
  1. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  2. 26
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

@ -111,8 +111,7 @@ namespace Debugger
this.thread = thread; this.thread = thread;
this.chainIndex = chainIndex; this.chainIndex = chainIndex;
this.frameIndex = frameIndex; this.frameIndex = frameIndex;
this.corILFrame = corILFrame; this.CorILFrame = corILFrame;
this.corILFramePauseSession = debugger.PauseSession;
corFunction = corILFrame.Function; corFunction = corILFrame.Function;
module = debugger.GetModule(corFunction.Module); module = debugger.GetModule(corFunction.Module);
@ -137,6 +136,7 @@ namespace Debugger
return corILFrame; return corILFrame;
} }
set { set {
if (value == null) throw new DebuggerException("Can not set frame to null");
corILFrame = value; corILFrame = value;
corILFramePauseSession = debugger.PauseSession; corILFramePauseSession = debugger.PauseSession;
} }

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

@ -191,9 +191,11 @@ namespace Debugger
foreach(ICorDebugFrame corFrame in corFrameEnum.Enumerator) { foreach(ICorDebugFrame corFrame in corFrameEnum.Enumerator) {
frameIndex--; frameIndex--;
Function function = GetFunctionFromCache(chainIndex, frameIndex, corFrame); if (corFrame.Is<ICorDebugILFrame>()) {
if (function != null) { Function function = GetFunctionFromCache(chainIndex, frameIndex, corFrame.As<ICorDebugILFrame>());
yield return function; if (function != null) {
yield return function;
}
} }
} }
} }
@ -206,7 +208,7 @@ namespace Debugger
public Dictionary<uint, Function> Frames = new Dictionary<uint, Function>(); public Dictionary<uint, Function> Frames = new Dictionary<uint, Function>();
} }
Function GetFunctionFromCache(uint chainIndex, uint frameIndex, ICorDebugFrame corFrame) Function GetFunctionFromCache(uint chainIndex, uint frameIndex, ICorDebugILFrame corFrame)
{ {
try { try {
if (chainCache.ContainsKey(chainIndex) && if (chainCache.ContainsKey(chainIndex) &&
@ -214,18 +216,14 @@ namespace Debugger
!chainCache[chainIndex].Frames[frameIndex].HasExpired) { !chainCache[chainIndex].Frames[frameIndex].HasExpired) {
Function function = chainCache[chainIndex].Frames[frameIndex]; Function function = chainCache[chainIndex].Frames[frameIndex];
function.CorILFrame = corFrame.As<ICorDebugILFrame>(); function.CorILFrame = corFrame;
return function; return function;
} else { } else {
if (corFrame.Is<ICorDebugILFrame>()) { Function function = new Function(this, chainIndex, frameIndex, corFrame.CastTo<ICorDebugILFrame>());
Function function = new Function(this, chainIndex, frameIndex, corFrame.CastTo<ICorDebugILFrame>()); if (!chainCache.ContainsKey(chainIndex)) chainCache[chainIndex] = new Chain();
if (!chainCache.ContainsKey(chainIndex)) chainCache[chainIndex] = new Chain(); chainCache[chainIndex].Frames[frameIndex] = function;
chainCache[chainIndex].Frames[frameIndex] = function; function.Expired += delegate { chainCache[chainIndex].Frames.Remove(frameIndex); };
function.Expired += delegate { chainCache[chainIndex].Frames.Remove(frameIndex); }; return function;
return function;
} else {
return null;
}
} }
} catch (COMException) { // TODO } catch (COMException) { // TODO
return null; return null;

Loading…
Cancel
Save