From 1d73ae154e968edbe4c5d4fd680bf0927617b417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Mon, 25 Jul 2005 15:43:41 +0000 Subject: [PATCH] Bugfixes - Thread and Callstack switching; unmanaged functions refused git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@254 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Pads/CallStackPad.cs | 2 +- .../Project/Src/Service/WindowsDebugger.cs | 2 +- .../Src/Debugger/Internal/ManagedCallback.cs | 9 +++++++++ .../Project/Src/Threads/Function.cs | 18 +++++++++--------- .../Project/Src/Threads/Thread.cs | 6 ++++-- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs index eb34851777..58f367aa84 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs @@ -86,7 +86,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads void CallStackListItemActivate(object sender, EventArgs e) { - if (!debuggerCore.IsCurrentProcessSafeForInspection) { + if (debuggerCore.IsCurrentProcessSafeForInspection) { debuggerCore.CurrentThread.CurrentFunction = (Function)(callStackList.SelectedItems[0].Tag); } } diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs index 48c18f2a41..6ce6766451 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs @@ -367,7 +367,7 @@ namespace ICSharpCode.SharpDevelop.Services return; case ExceptionForm.Result.Ignore: debugger.CurrentThread.InterceptCurrentException(); - return; + break; } } else { JumpToCurrentLine(); diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs index 4a7be6a100..331951db9f 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs @@ -46,6 +46,9 @@ namespace DebuggerLibrary Process process = debugger.GetProcess(pProcess); process.IsProcessRunning = false; debugger.CurrentProcess = process; + foreach(Thread t in process.Threads) { + t.CurrentFunction = null; + } } // Sets CurrentProcess @@ -58,6 +61,9 @@ namespace DebuggerLibrary Process process = debugger.GetProcess(pProcess); process.IsProcessRunning = false; debugger.CurrentProcess = process; + foreach(Thread t in process.Threads) { + t.CurrentFunction = null; + } } // Sets CurrentProcess, CurrentThread and CurrentFunction @@ -71,6 +77,9 @@ namespace DebuggerLibrary process.IsProcessRunning = false; debugger.CurrentProcess = process; process.CurrentThread = thread; + foreach(Thread t in process.Threads) { + t.CurrentFunction = null; + } thread.CurrentFunction = thread.LastFunctionWithLoadedSymbols; } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs index b6dadb412b..1eb76779bf 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs @@ -22,7 +22,7 @@ namespace DebuggerLibrary NDebugger debugger; Module module; - ICorDebugFrame corFrame; + ICorDebugILFrame corILFrame; ICorDebugFunction corFunction; MethodProps methodProps; @@ -65,11 +65,11 @@ namespace DebuggerLibrary } } - internal unsafe Function(NDebugger debugger, ICorDebugFrame corFrame) + internal unsafe Function(NDebugger debugger, ICorDebugILFrame corILFrame) { this.debugger = debugger; - this.corFrame = corFrame; - corFrame.GetFunction(out corFunction); + this.corILFrame = corILFrame; + corILFrame.GetFunction(out corFunction); uint functionToken; corFunction.GetToken(out functionToken); ICorDebugModule corModule; @@ -81,9 +81,9 @@ namespace DebuggerLibrary #region Helpping proprerties - internal ICorDebugILFrame corILFrame { + internal ICorDebugILFrame CorILFrame { get { - return (ICorDebugILFrame) corFrame; + return corILFrame; } } @@ -135,7 +135,7 @@ namespace DebuggerLibrary public void StepOut() { ICorDebugStepper stepper; - corFrame.CreateStepper(out stepper); + corILFrame.CreateStepper(out stepper); stepper.StepOut(); debugger.CurrentThread.AddActiveStepper(stepper); @@ -159,7 +159,7 @@ namespace DebuggerLibrary ICorDebugStepper stepper; if (stepIn) { - corFrame.CreateStepper(out stepper); + corILFrame.CreateStepper(out stepper); fixed (int* ranges = nextSt.StepRanges) { stepper.StepRange(1 /* true - step in*/ , (IntPtr)ranges, (uint)nextSt.StepRanges.Length / 2); @@ -171,7 +171,7 @@ namespace DebuggerLibrary // Mind that step in which ends in code without symblols is cotinued // so the next step out ensures that we atleast do step over - corFrame.CreateStepper(out stepper); + corILFrame.CreateStepper(out stepper); fixed (int* ranges = nextSt.StepRanges) { stepper.StepRange(0 /* false - step over*/ , (IntPtr)ranges, (uint)nextSt.StepRanges.Length / 2); diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs index 72fb6d071d..f1796f39a9 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs @@ -134,7 +134,7 @@ namespace DebuggerLibrary public void InterceptCurrentException() { - ((ICorDebugThread2)corThread).InterceptCurrentException(LastFunction.corILFrame); + ((ICorDebugThread2)corThread).InterceptCurrentException(LastFunction.CorILFrame); process.Continue(); } @@ -213,7 +213,9 @@ namespace DebuggerLibrary if (framesFetched == 0) break; // We are done try { - callstack.Add(new Function(debugger, corFrames[0])); + if (corFrames[0] is ICorDebugILFrame) { + callstack.Add(new Function(debugger, (ICorDebugILFrame)corFrames[0])); + } } catch (COMException) { // TODO };