Browse Source

Fixed possible freeze of debugger that could occur after exception in NGENed code.

4.1
David Srbecký 14 years ago
parent
commit
f9212ea17c
  1. 14
      src/AddIns/Debugger/Debugger.Core/Thread.cs

14
src/AddIns/Debugger/Debugger.Core/Thread.cs

@ -208,10 +208,22 @@ namespace Debugger @@ -208,10 +208,22 @@ namespace Debugger
if (this.CorThread.GetCurrentException() == null) return false; // Is there any exception
if (this.MostRecentStackFrame == null) return false; // Is frame available? It is not at StackOverflow
// Intercepting an exception on an optimized/NGENed frame seems to sometimes
// freeze the debugee (as of .NET 4.0, it was ok in .NET 2.0)
// eg. Convert.ToInt64(ulong.MaxValue) causes such freeze
StackFrame mostRecentUnoptimized = null;
foreach(StackFrame sf in this.Callstack) {
if (sf.MethodInfo.DebugModule.CorModule2.GetJITCompilerFlags() != 1) { // CORDEBUG_JIT_DEFAULT
mostRecentUnoptimized = sf;
break;
}
}
if (mostRecentUnoptimized == null) return false;
try {
// Interception will expire the CorValue so keep permanent reference
currentException.MakeValuePermanent();
((ICorDebugThread2)this.CorThread).InterceptCurrentException(this.MostRecentStackFrame.CorILFrame);
((ICorDebugThread2)this.CorThread).InterceptCurrentException(mostRecentUnoptimized.CorILFrame);
} catch (COMException e) {
// 0x80131C02: Cannot intercept this exception
if ((uint)e.ErrorCode == 0x80131C02)

Loading…
Cancel
Save