From b138040f0e0911b424cc73735eaa9712dac37b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Sat, 24 Oct 2009 13:23:47 +0000 Subject: [PATCH] Minor tweaks git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5173 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- src/AddIns/Misc/Debugger/Debugger.Core/Eval.cs | 10 +++++++++- .../Misc/Debugger/Debugger.Core/ManagedCallback.cs | 3 ++- .../Misc/Debugger/Debugger.Core/MetaData/DebugType.cs | 5 ++++- .../NRefactory/Visitors/ExpressionEvaluator.cs | 1 - src/AddIns/Misc/Debugger/Debugger.Core/Thread.cs | 2 +- src/AddIns/Misc/Debugger/Debugger.Core/Value.cs | 2 +- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Eval.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Eval.cs index e70a3186c4..7491c34625 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Eval.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Eval.cs @@ -123,9 +123,17 @@ namespace Debugger { appDomain.Process.AssertPaused(); - // TODO: Select thread in the correct AppDomain Thread targetThread = appDomain.Process.SelectedThread; + if (targetThread.CorThread.GetAppDomain().GetID() != appDomain.ID) { + foreach(Thread thread in appDomain.Process.Threads) { + if (thread.CorThread.GetAppDomain().GetID() == appDomain.ID) { + targetThread = thread; + break; + } + } + } + if (targetThread == null) { throw new GetValueException("Can not evaluate because no thread is selected"); } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/ManagedCallback.cs b/src/AddIns/Misc/Debugger/Debugger.Core/ManagedCallback.cs index 416c60c79e..1b20b9d58e 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/ManagedCallback.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/ManagedCallback.cs @@ -420,7 +420,8 @@ namespace Debugger } else { EnterCallback(PausedReason.Other, "ExitThread " + pThread.GetID(), process.CorProcess); - // TODO: Investigate + // .NET 4.0 - It seems that the API is reporting exits of threads without announcing their creation. + // TODO: Remove in next .NET 4.0 beta and investigate process.TraceMessage("ERROR: Thread does not exist " + pThread.GetID()); } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/MetaData/DebugType.cs b/src/AddIns/Misc/Debugger/Debugger.Core/MetaData/DebugType.cs index b9b55eb695..64253d36cc 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/MetaData/DebugType.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/MetaData/DebugType.cs @@ -1086,7 +1086,8 @@ namespace Debugger.MetaData DebugType(AppDomain appDomain, ICorDebugType corType) { - if (corType == null) throw new ArgumentNullException("corType"); + if (corType == null) + throw new ArgumentNullException("corType"); this.corType = corType; this.corElementType = (CorElementType)corType.GetTheType(); @@ -1124,6 +1125,8 @@ namespace Debugger.MetaData // Get class props this.module = appDomain.Process.Modules[corType.GetClass().GetModule()]; this.classProps = module.MetaData.GetTypeDefProps(corType.GetClass().GetToken()); + if (this.DebugModule.AppDomain != appDomain) + throw new DebuggerException("The specified AppDomain was inccorect"); // Get the enclosing class if (!this.IsPublic && !this.IsNotPublic) { uint enclosingTk = module.MetaData.GetNestedClassProps((uint)this.MetadataToken).EnclosingClass; diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/NRefactory/Visitors/ExpressionEvaluator.cs b/src/AddIns/Misc/Debugger/Debugger.Core/NRefactory/Visitors/ExpressionEvaluator.cs index 53646597b6..cc4d103b4e 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/NRefactory/Visitors/ExpressionEvaluator.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/NRefactory/Visitors/ExpressionEvaluator.cs @@ -753,7 +753,6 @@ namespace ICSharpCode.NRefactory.Visitors if (left.Value.IsNull || right.Value.IsNull) { return CreateValue(left.Value.IsNull && right.Value.IsNull); } else { - // TODO: Make sure this works for byrefs and arrays return CreateValue(left.Value.Address == right.Value.Address); } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Thread.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Thread.cs index fa4f5efa43..9018504f09 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Thread.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Thread.cs @@ -303,7 +303,7 @@ namespace Debugger StackFrame stackFrame; try { stackFrame = new StackFrame(this, (ICorDebugILFrame)corFrame, corChainIndex, corFrameIndex); - } catch (COMException) { // TODO + } catch (COMException) { // TODO: Remove continue; }; yield return stackFrame; diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Value.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Value.cs index 46153f2d90..23b56c108d 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Value.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Value.cs @@ -201,7 +201,7 @@ namespace Debugger return this; } else if (this.CorValue is ICorDebugReferenceValue) { if (this.CorReferenceValue.IsNull() > 0) - return this; // ("null" expression) TODO + return this; // ("null" expression) TODO: It isn't permanent ICorDebugValue deRef = this.CorReferenceValue.Dereference(); if (deRef is ICorDebugHeapValue2) { return new Value(appDomain, ((ICorDebugHeapValue2)deRef).CreateHandle(CorDebugHandleType.HANDLE_STRONG));