diff options
author | Artem Bukhonov <artem.bukhonov@jetbrains.com> | 2017-01-27 21:39:36 +0300 |
---|---|---|
committer | Artem Bukhonov <Artem.Bukhonov@jetbrains.com> | 2017-01-27 22:05:33 +0300 |
commit | 10f52dfb7e85b0530eb39750439ffd3b84080f96 (patch) | |
tree | 0effeab035de56b0de7f4f8ad529b24125807cb8 /main/src/addins/MonoDevelop.Debugger.Win32 | |
parent | abceea50727c05da699f1fa6ed60a0c43bebdc4f (diff) |
Isolation of COMException in GetFrames(). Sometimes fetching frames may throw CORDBG_E_BAD_THREAD_STATE, and we should handle it. Otherwise the debugger event thread will be corrupted.
(cherry picked from commit 39d4670)
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger.Win32')
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger.Win32/Mono.Debugging.Win32/CorDebuggerBacktrace.cs | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/Mono.Debugging.Win32/CorDebuggerBacktrace.cs b/main/src/addins/MonoDevelop.Debugger.Win32/Mono.Debugging.Win32/CorDebuggerBacktrace.cs index 5de0135b49..ea3d64e164 100644 --- a/main/src/addins/MonoDevelop.Debugger.Win32/Mono.Debugging.Win32/CorDebuggerBacktrace.cs +++ b/main/src/addins/MonoDevelop.Debugger.Win32/Mono.Debugging.Win32/CorDebuggerBacktrace.cs @@ -7,6 +7,7 @@ using Microsoft.Samples.Debugging.CorMetadata; using Mono.Debugging.Client;
using Mono.Debugging.Evaluation;
using System.Linq;
+using System.Runtime.InteropServices;
namespace Mono.Debugging.Win32
{
@@ -29,12 +30,27 @@ namespace Mono.Debugging.Win32 internal static IEnumerable<CorFrame> GetFrames (CorThread thread)
{
- foreach (CorChain chain in thread.Chains) {
- if (!chain.IsManaged)
- continue;
- foreach (CorFrame frame in chain.Frames)
- yield return frame;
+ var corFrames = new List<CorFrame> ();
+ try {
+ foreach (CorChain chain in thread.Chains) {
+ if (!chain.IsManaged)
+ continue;
+ try {
+ var chainFrames = chain.Frames;
+
+ foreach (CorFrame frame in chainFrames)
+ corFrames.Add (frame);
+ }
+ catch (COMException e) {
+ DebuggerLoggingService.LogMessage ("Failed to enumerate frames of chain: {0}", e.Message);
+ }
+ }
+
+ }
+ catch (COMException e) {
+ DebuggerLoggingService.LogMessage ("Failed to enumerate chains of thread: {0}", e.Message);
}
+ return corFrames;
}
internal List<CorFrame> FrameList {
|