Browse Source

Do not throw exception when the debugger encounters thread which we do not know about.

pull/6/merge
David Srbecký 14 years ago
parent
commit
0a98924dd2
  1. 8
      src/AddIns/Debugger/Debugger.Core/ManagedCallback.cs
  2. 12
      src/AddIns/Debugger/Debugger.Core/Process.cs
  3. 11
      src/AddIns/Debugger/Debugger.Core/ThreadCollection.cs

8
src/AddIns/Debugger/Debugger.Core/ManagedCallback.cs

@ -74,7 +74,7 @@ namespace Debugger @@ -74,7 +74,7 @@ namespace Debugger
void EnterCallback(PausedReason pausedReason, string name, ICorDebugThread pThread)
{
EnterCallback(pausedReason, name, pThread.GetProcess());
process.SelectedThread = process.Threads[pThread];
process.SelectedThread = process.GetThread(pThread);
}
void ExitCallback()
@ -128,7 +128,7 @@ namespace Debugger @@ -128,7 +128,7 @@ namespace Debugger
{
EnterCallback(PausedReason.StepComplete, "StepComplete (" + reason.ToString() + ")", pThread);
Thread thread = process.Threads[pThread];
Thread thread = process.GetThread(pThread);
Stepper stepper = process.GetStepper(pStepper);
StackFrame currentStackFrame = process.SelectedThread.MostRecentStackFrame;
@ -378,7 +378,7 @@ namespace Debugger @@ -378,7 +378,7 @@ namespace Debugger
EnterCallback(PausedReason.Other, "NameChange: pThread", pThread);
Thread thread = process.Threads[pThread];
Thread thread = process.GetThread(pThread);
thread.NotifyNameChanged();
ExitCallback();
@ -445,7 +445,7 @@ namespace Debugger @@ -445,7 +445,7 @@ namespace Debugger
if (process.Threads.Contains(pThread)) {
EnterCallback(PausedReason.Other, "ExitThread " + pThread.GetID(), pThread);
process.Threads[pThread].NotifyExited();
process.GetThread(pThread).NotifyExited();
} else {
EnterCallback(PausedReason.Other, "ExitThread " + pThread.GetID(), process.CorProcess);

12
src/AddIns/Debugger/Debugger.Core/Process.cs

@ -233,6 +233,18 @@ namespace Debugger @@ -233,6 +233,18 @@ namespace Debugger
return written;
}
internal Thread GetThread(ICorDebugThread corThread)
{
foreach(Thread thread in this.Threads) {
if (thread.CorThread == corThread) {
return thread;
}
}
Thread t = new Thread(this, corThread);
this.Threads.Add(t);
return t;
}
#region Exceptions
public event EventHandler<ExceptionEventArgs> ExceptionThrown;

11
src/AddIns/Debugger/Debugger.Core/ThreadCollection.cs

@ -38,16 +38,5 @@ namespace Debugger @@ -38,16 +38,5 @@ namespace Debugger
}
return false;
}
internal Thread this[ICorDebugThread corThread] {
get {
foreach(Thread thread in this) {
if (thread.CorThread == corThread) {
return thread;
}
}
throw new DebuggerException("Thread is not in collection");
}
}
}
}

Loading…
Cancel
Save