Browse Source

Moving functionality from NDebugger to Process - rename debugger to process

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1686 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 19 years ago
parent
commit
ca43545dd8
  1. 6
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs
  2. 8
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  3. 14
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/DebugeeState.cs
  4. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/DebuggerEvents/MessageEventArgs.cs
  5. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/ExceptionEventArgs.cs
  6. 84
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs
  7. 8
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallbackProxy.cs
  8. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Process-StateControl.cs
  9. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs
  10. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/ModuleEventArgs.cs
  11. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Process-Modules.cs
  12. 12
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs
  13. 38
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  14. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process-Threads.cs
  15. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs
  16. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Stepper.cs
  17. 25
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs
  18. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/ThreadEventArgs.cs
  19. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/CallFunctionEval.cs
  20. 30
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs
  21. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/EvalEventArgs.cs
  22. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/NewObjectEval.cs
  23. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/NewStringEval.cs
  24. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Process-Evals.cs
  25. 24
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectValueClass.cs
  26. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs
  27. 18
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs
  28. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableEventArgs.cs

6
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs

@ -163,15 +163,15 @@ namespace ICSharpCode.SharpDevelop.Services
void DoInPausedState(MethodInvoker action) void DoInPausedState(MethodInvoker action)
{ {
if (Variable.Debugger.IsPaused) { if (Variable.Process.IsPaused) {
action(); action();
} else { } else {
EventHandler<DebuggerEventArgs> onDebuggingPaused = null; EventHandler<DebuggerEventArgs> onDebuggingPaused = null;
onDebuggingPaused = delegate { onDebuggingPaused = delegate {
action(); action();
Variable.Debugger.DebuggingPaused -= onDebuggingPaused; Variable.Process.DebuggingPaused -= onDebuggingPaused;
}; };
Variable.Debugger.DebuggingPaused += onDebuggingPaused; Variable.Process.DebuggingPaused += onDebuggingPaused;
} }
} }

8
src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj

@ -64,7 +64,7 @@
<Compile Include="Src\Interop enums\CorTokenType.cs" /> <Compile Include="Src\Interop enums\CorTokenType.cs" />
<Compile Include="Src\Modules\Module.cs" /> <Compile Include="Src\Modules\Module.cs" />
<Compile Include="Src\Modules\ModuleEventArgs.cs" /> <Compile Include="Src\Modules\ModuleEventArgs.cs" />
<Compile Include="Src\Modules\NDebugger-Modules.cs" /> <Compile Include="Src\Modules\Process-Modules.cs" />
<Compile Include="Src\RemotingSinks\PrivateEventHandlersSink\AsyncMessageResponseSink.cs" /> <Compile Include="Src\RemotingSinks\PrivateEventHandlersSink\AsyncMessageResponseSink.cs" />
<Compile Include="Src\RemotingSinks\PrivateEventHandlersSink\MyProxy.cs" /> <Compile Include="Src\RemotingSinks\PrivateEventHandlersSink\MyProxy.cs" />
<Compile Include="Src\Debugger\Internal\RemotingObjectBase.cs" /> <Compile Include="Src\Debugger\Internal\RemotingObjectBase.cs" />
@ -72,7 +72,7 @@
<Compile Include="Src\Threads\ExceptionType.cs" /> <Compile Include="Src\Threads\ExceptionType.cs" />
<Compile Include="Src\Threads\Function.cs" /> <Compile Include="Src\Threads\Function.cs" />
<Compile Include="Src\Threads\NDebugger-Processes.cs" /> <Compile Include="Src\Threads\NDebugger-Processes.cs" />
<Compile Include="Src\Threads\NDebugger-Threads.cs" /> <Compile Include="Src\Threads\Process-Threads.cs" />
<Compile Include="Src\Threads\Process.cs" /> <Compile Include="Src\Threads\Process.cs" />
<Compile Include="Src\Threads\ProcessEventArgs.cs" /> <Compile Include="Src\Threads\ProcessEventArgs.cs" />
<Compile Include="Src\Threads\SourcecodeSegment.cs" /> <Compile Include="Src\Threads\SourcecodeSegment.cs" />
@ -85,7 +85,7 @@
<Compile Include="Src\RemotingSinks\PrivateEventHandlersSink\PrivateEventHandlersClientChannelSinkProvider.cs" /> <Compile Include="Src\RemotingSinks\PrivateEventHandlersSink\PrivateEventHandlersClientChannelSinkProvider.cs" />
<Compile Include="Src\RemotingSinks\PrivateEventHandlersSink\EventForwarder.cs" /> <Compile Include="Src\RemotingSinks\PrivateEventHandlersSink\EventForwarder.cs" />
<Compile Include="Src\RemotingSinks\PrivateEventHandlersSink\PrivateEventHandlersClientChannelSink.cs" /> <Compile Include="Src\RemotingSinks\PrivateEventHandlersSink\PrivateEventHandlersClientChannelSink.cs" />
<Compile Include="Src\Debugger\NDebugger-StateControl.cs" /> <Compile Include="Src\Debugger\Process-StateControl.cs" />
<Compile Include="Src\Interop\CorDebug\_COR_IL_MAP.cs" /> <Compile Include="Src\Interop\CorDebug\_COR_IL_MAP.cs" />
<Compile Include="Src\Interop\CorDebug\_COR_VERSION.cs" /> <Compile Include="Src\Interop\CorDebug\_COR_VERSION.cs" />
<Compile Include="Src\Interop\CorDebug\_FILETIME.cs" /> <Compile Include="Src\Interop\CorDebug\_FILETIME.cs" />
@ -183,7 +183,7 @@
<Compile Include="Src\Interop\MetaData\COR_FIELD_OFFSET.cs" /> <Compile Include="Src\Interop\MetaData\COR_FIELD_OFFSET.cs" />
<Compile Include="Src\Variables\Evals\Eval.cs" /> <Compile Include="Src\Variables\Evals\Eval.cs" />
<Compile Include="Src\Variables\Evals\EvalEventArgs.cs" /> <Compile Include="Src\Variables\Evals\EvalEventArgs.cs" />
<Compile Include="Src\Variables\Evals\NDebugger-Evals.cs" /> <Compile Include="Src\Variables\Evals\Process-Evals.cs" />
<Compile Include="Src\Variables\ArrayValue.cs" /> <Compile Include="Src\Variables\ArrayValue.cs" />
<Compile Include="Src\Variables\NullValue.cs" /> <Compile Include="Src\Variables\NullValue.cs" />
<Compile Include="Src\Variables\ObjectValueClass.cs" /> <Compile Include="Src\Variables\ObjectValueClass.cs" />

14
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/DebugeeState.cs

@ -15,23 +15,23 @@ namespace Debugger
/// </summary> /// </summary>
public class DebugeeState: IExpirable, IMutable public class DebugeeState: IExpirable, IMutable
{ {
NDebugger debugger; Process process;
bool hasExpired = false; bool hasExpired = false;
public event EventHandler Expired; public event EventHandler Expired;
public event EventHandler<DebuggerEventArgs> Changed { public event EventHandler<DebuggerEventArgs> Changed {
add { add {
debugger.DebuggeeStateChanged += value; process.DebuggeeStateChanged += value;
} }
remove { remove {
debugger.DebuggeeStateChanged -= value; process.DebuggeeStateChanged -= value;
} }
} }
public NDebugger Debugger { public Process Process {
get { get {
return debugger; return process;
} }
} }
@ -51,9 +51,9 @@ namespace Debugger
} }
} }
public DebugeeState(NDebugger debugger) public DebugeeState(Process process)
{ {
this.debugger = debugger; this.process = process;
} }
} }
} }

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/DebuggerEvents/MessageEventArgs.cs

@ -34,12 +34,12 @@ namespace Debugger
} }
} }
public MessageEventArgs(NDebugger debugger, string message): this(debugger, 0, message, String.Empty) public MessageEventArgs(Process process, string message): this(process, 0, message, String.Empty)
{ {
this.message = message; this.message = message;
} }
public MessageEventArgs(NDebugger debugger, int level, string message, string category): base(debugger) public MessageEventArgs(Process process, int level, string message, string category): base(process)
{ {
this.level = level; this.level = level;
this.message = message; this.message = message;

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/ExceptionEventArgs.cs

@ -29,7 +29,7 @@ namespace Debugger
} }
} }
public ExceptionEventArgs(NDebugger debugger, Exception exception):base(debugger) public ExceptionEventArgs(Process process, Exception exception):base(process)
{ {
this.exception = exception; this.exception = exception;
} }

84
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs

@ -22,40 +22,40 @@ namespace Debugger
{ {
class ManagedCallback class ManagedCallback
{ {
NDebugger debugger; Process process;
bool pauseProcessInsteadOfContinue; bool pauseProcessInsteadOfContinue;
public NDebugger Debugger { public Process Process {
get { get {
return debugger; return process;
} }
} }
public ManagedCallback(NDebugger debugger) public ManagedCallback(Process process)
{ {
this.debugger = debugger; this.process = process;
} }
void EnterCallback(PausedReason pausedReason, string name, ICorDebugProcess pProcess) void EnterCallback(PausedReason pausedReason, string name, ICorDebugProcess pProcess)
{ {
debugger.TraceMessage("Callback: " + name); process.TraceMessage("Callback: " + name);
// Check state // Check state
if (debugger.IsRunning || if (process.IsRunning ||
// After break is pressed we may receive some messages that were already queued // After break is pressed we may receive some messages that were already queued
debugger.PauseSession.PausedReason == PausedReason.ForcedBreak || process.PauseSession.PausedReason == PausedReason.ForcedBreak ||
// ExitProcess may be called at any time when debuggee is killed // ExitProcess may be called at any time when debuggee is killed
name == "ExitProcess") { name == "ExitProcess") {
debugger.SelectedProcess = debugger.GetProcess(pProcess); process.SelectedProcess = process.GetProcess(pProcess);
if (debugger.IsPaused && debugger.PauseSession.PausedReason == PausedReason.ForcedBreak) { if (process.IsPaused && process.PauseSession.PausedReason == PausedReason.ForcedBreak) {
debugger.TraceMessage("Processing post-break callback"); process.TraceMessage("Processing post-break callback");
// Continue the break, process is still breaked because of the callback // Continue the break, process is still breaked because of the callback
debugger.SelectedProcess.Continue(); process.SelectedProcess.Continue();
pauseProcessInsteadOfContinue = true; pauseProcessInsteadOfContinue = true;
} else { } else {
pauseProcessInsteadOfContinue = false; pauseProcessInsteadOfContinue = false;
} }
debugger.SelectedProcess.NotifyPaused(new PauseSession(pausedReason)); process.SelectedProcess.NotifyPaused(new PauseSession(pausedReason));
} else { } else {
throw new DebuggerException("Invalid state at the start of callback"); throw new DebuggerException("Invalid state at the start of callback");
} }
@ -69,9 +69,9 @@ namespace Debugger
void EnterCallback(PausedReason pausedReason, string name, ICorDebugThread pThread) void EnterCallback(PausedReason pausedReason, string name, ICorDebugThread pThread)
{ {
EnterCallback(pausedReason, name, pThread.Process); EnterCallback(pausedReason, name, pThread.Process);
debugger.SelectedProcess.SelectedThread = debugger.GetThread(pThread); process.SelectedProcess.SelectedThread = process.GetThread(pThread);
// Remove expired functions from the callstack cache // Remove expired functions from the callstack cache
debugger.SelectedProcess.SelectedThread.CheckExpirationOfFunctions(); process.SelectedProcess.SelectedThread.CheckExpirationOfFunctions();
} }
void ExitCallback_Continue() void ExitCallback_Continue()
@ -79,17 +79,17 @@ namespace Debugger
if (pauseProcessInsteadOfContinue) { if (pauseProcessInsteadOfContinue) {
ExitCallback_Paused(); ExitCallback_Paused();
} else { } else {
debugger.SelectedProcess.Continue(); process.SelectedProcess.Continue();
} }
} }
void ExitCallback_Paused() void ExitCallback_Paused()
{ {
if (debugger.Evaluating) { if (process.Evaluating) {
// Ignore events during property evaluation // Ignore events during property evaluation
ExitCallback_Continue(); ExitCallback_Continue();
} else { } else {
debugger.Pause(debugger.PauseSession.PausedReason != PausedReason.EvalComplete); process.Pause(process.PauseSession.PausedReason != PausedReason.EvalComplete);
} }
} }
@ -100,27 +100,27 @@ namespace Debugger
{ {
EnterCallback(PausedReason.StepComplete, "StepComplete (" + reason.ToString() + ")", pThread); EnterCallback(PausedReason.StepComplete, "StepComplete (" + reason.ToString() + ")", pThread);
Thread thread = debugger.GetThread(pThread); Thread thread = process.GetThread(pThread);
Stepper stepper = thread.GetStepper(pStepper); Stepper stepper = thread.GetStepper(pStepper);
debugger.TraceMessage(" - stepper info: " + stepper.ToString()); process.TraceMessage(" - stepper info: " + stepper.ToString());
thread.Steppers.Remove(stepper); thread.Steppers.Remove(stepper);
stepper.OnStepComplete(); stepper.OnStepComplete();
if (stepper.PauseWhenComplete) { if (stepper.PauseWhenComplete) {
if (debugger.SelectedThread.LastFunction.HasSymbols) { if (process.SelectedThread.LastFunction.HasSymbols) {
ExitCallback_Paused(); ExitCallback_Paused();
} else { } else {
// This can only happen when JMC is disabled (ie NET1.1 or StepOut) // This can only happen when JMC is disabled (ie NET1.1 or StepOut)
if (stepper.Operation == Stepper.StepperOperation.StepOut) { if (stepper.Operation == Stepper.StepperOperation.StepOut) {
// Create new stepper and keep going // Create new stepper and keep going
debugger.TraceMessage(" - stepping out of code without symbols at " + debugger.SelectedThread.LastFunction.ToString()); process.TraceMessage(" - stepping out of code without symbols at " + process.SelectedThread.LastFunction.ToString());
new Stepper(debugger.SelectedThread.LastFunction, "Stepper out of code without symbols").StepOut(); new Stepper(process.SelectedThread.LastFunction, "Stepper out of code without symbols").StepOut();
ExitCallback_Continue(); ExitCallback_Continue();
} else { } else {
// NET1.1: There is extra step over stepper, just keep going // NET1.1: There is extra step over stepper, just keep going
debugger.TraceMessage(" - leaving code without symbols"); process.TraceMessage(" - leaving code without symbols");
ExitCallback_Continue(); ExitCallback_Continue();
} }
} }
@ -169,7 +169,7 @@ namespace Debugger
{ {
// Exception2 is used in .NET Framework 2.0 // Exception2 is used in .NET Framework 2.0
if (debugger.DebuggeeVersion.StartsWith("v1.")) { if (process.DebuggeeVersion.StartsWith("v1.")) {
// Forward the call to Exception2, which handles EnterCallback and ExitCallback // Forward the call to Exception2, which handles EnterCallback and ExitCallback
ExceptionType exceptionType = (unhandled != 0)?ExceptionType.DEBUG_EXCEPTION_UNHANDLED:ExceptionType.DEBUG_EXCEPTION_FIRST_CHANCE; ExceptionType exceptionType = (unhandled != 0)?ExceptionType.DEBUG_EXCEPTION_UNHANDLED:ExceptionType.DEBUG_EXCEPTION_FIRST_CHANCE;
Exception2(pAppDomain, pThread, null, 0, (CorDebugExceptionCallbackType)exceptionType, 0); Exception2(pAppDomain, pThread, null, 0, (CorDebugExceptionCallbackType)exceptionType, 0);
@ -196,7 +196,7 @@ namespace Debugger
{ {
EnterCallback(PausedReason.Other, "LogMessage", pThread); EnterCallback(PausedReason.Other, "LogMessage", pThread);
debugger.OnLogMessage(new MessageEventArgs(debugger, lLevel, pMessage, pLogSwitchName)); process.OnLogMessage(new MessageEventArgs(process, lLevel, pMessage, pLogSwitchName));
ExitCallback_Continue(); ExitCallback_Continue();
} }
@ -226,11 +226,11 @@ namespace Debugger
{ {
// Let the eval know it that the CorEval has finished // Let the eval know it that the CorEval has finished
// this will also remove the eval form PendingEvals collection // this will also remove the eval form PendingEvals collection
Eval eval = debugger.GetEval(corEval); Eval eval = process.GetEval(corEval);
eval.NotifyEvaluationComplete(!exception); eval.NotifyEvaluationComplete(!exception);
debugger.NotifyEvaluationComplete(eval); process.NotifyEvaluationComplete(eval);
if (debugger.SetupNextEvaluation()) { if (process.SetupNextEvaluation()) {
ExitCallback_Continue(); ExitCallback_Continue();
} else { } else {
ExitCallback_Paused(); ExitCallback_Paused();
@ -292,7 +292,7 @@ namespace Debugger
{ {
EnterCallback(PausedReason.Other, "LoadModule", pAppDomain); EnterCallback(PausedReason.Other, "LoadModule", pAppDomain);
debugger.AddModule(pModule); process.AddModule(pModule);
ExitCallback_Continue(); ExitCallback_Continue();
} }
@ -310,7 +310,7 @@ namespace Debugger
EnterCallback(PausedReason.Other, "NameChange: pThread", pThread); EnterCallback(PausedReason.Other, "NameChange: pThread", pThread);
Thread thread = debugger.GetThread(pThread); Thread thread = process.GetThread(pThread);
thread.HasBeenLoaded = true; thread.HasBeenLoaded = true;
ExitCallback_Continue(); ExitCallback_Continue();
@ -324,7 +324,7 @@ namespace Debugger
// and we continue from this callback anyway // and we continue from this callback anyway
EnterCallback(PausedReason.Other, "CreateThread", pAppDomain); EnterCallback(PausedReason.Other, "CreateThread", pAppDomain);
debugger.AddThread(pThread); process.AddThread(pThread);
ExitCallback_Continue(); ExitCallback_Continue();
} }
@ -351,7 +351,7 @@ namespace Debugger
{ {
EnterCallback(PausedReason.Other, "UnloadModule", pAppDomain); EnterCallback(PausedReason.Other, "UnloadModule", pAppDomain);
debugger.RemoveModule(pModule); process.RemoveModule(pModule);
ExitCallback_Continue(); ExitCallback_Continue();
} }
@ -367,9 +367,9 @@ namespace Debugger
{ {
EnterCallback(PausedReason.Other, "ExitThread", pThread); EnterCallback(PausedReason.Other, "ExitThread", pThread);
Thread thread = debugger.GetThread(pThread); Thread thread = process.GetThread(pThread);
debugger.RemoveThread(thread); process.RemoveThread(thread);
if (thread.Process.SelectedThread == thread) { if (thread.Process.SelectedThread == thread) {
thread.Process.SelectedThread = null; thread.Process.SelectedThread = null;
@ -379,7 +379,7 @@ namespace Debugger
ExitCallback_Continue(); ExitCallback_Continue();
} catch (COMException e) { } catch (COMException e) {
// For some reason this sometimes happens in .NET 1.1 // For some reason this sometimes happens in .NET 1.1
debugger.TraceMessage("Continue failed in ExitThread callback: " + e.Message); process.TraceMessage("Continue failed in ExitThread callback: " + e.Message);
} }
} }
@ -394,13 +394,13 @@ namespace Debugger
{ {
EnterCallback(PausedReason.Other, "ExitProcess", pProcess); EnterCallback(PausedReason.Other, "ExitProcess", pProcess);
Process process = debugger.GetProcess(pProcess); Process process = process.GetProcess(pProcess);
debugger.RemoveProcess(process); process.RemoveProcess(process);
if (debugger.Processes.Count == 0) { if (process.Processes.Count == 0) {
// Exit callback and then terminate the debugger // Exit callback and then terminate the debugger
debugger.MTA2STA.AsyncCall( delegate { debugger.TerminateDebugger(); } ); process.MTA2STA.AsyncCall( delegate { process.TerminateDebugger(); } );
} }
} }
@ -437,11 +437,11 @@ namespace Debugger
// Whatch out for the zeros and null! // Whatch out for the zeros and null!
// Exception -> Exception2(pAppDomain, pThread, null, 0, exceptionType, 0); // Exception -> Exception2(pAppDomain, pThread, null, 0, exceptionType, 0);
debugger.SelectedThread.CurrentExceptionType = (ExceptionType)exceptionType; process.SelectedThread.CurrentExceptionType = (ExceptionType)exceptionType;
if (ExceptionType.DEBUG_EXCEPTION_UNHANDLED != (ExceptionType)exceptionType) { if (ExceptionType.DEBUG_EXCEPTION_UNHANDLED != (ExceptionType)exceptionType) {
// Handled exception // Handled exception
if (debugger.PauseOnHandledException) { if (process.PauseOnHandledException) {
ExitCallback_Paused(); ExitCallback_Paused();
} else { } else {
ExitCallback_Continue(); ExitCallback_Continue();

8
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallbackProxy.cs

@ -25,18 +25,18 @@ namespace Debugger
{ {
class ManagedCallbackProxy : ICorDebugManagedCallbacks class ManagedCallbackProxy : ICorDebugManagedCallbacks
{ {
NDebugger debugger; Process process;
ManagedCallback realCallback; ManagedCallback realCallback;
public NDebugger Debugger { public Process Process {
get { get {
return debugger; return process;
} }
} }
public ManagedCallbackProxy(ManagedCallback realCallback) public ManagedCallbackProxy(ManagedCallback realCallback)
{ {
this.debugger = realCallback.Debugger; this.debugger = realCallback.Process;
this.realCallback = realCallback; this.realCallback = realCallback;
} }

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs → src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Process-StateControl.cs

@ -16,7 +16,7 @@ using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {
public partial class NDebugger public partial class Process
{ {
bool pauseOnHandledException = false; bool pauseOnHandledException = false;
internal ManualResetEvent pausedHandle = new ManualResetEvent(false); internal ManualResetEvent pausedHandle = new ManualResetEvent(false);

10
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Module.cs

@ -17,7 +17,7 @@ namespace Debugger
{ {
public class Module: RemotingObjectBase, IDisposable public class Module: RemotingObjectBase, IDisposable
{ {
NDebugger debugger; Process process;
bool unloaded = false; bool unloaded = false;
string fullPath; string fullPath;
@ -27,9 +27,9 @@ namespace Debugger
ISymUnmanagedReader symReader; ISymUnmanagedReader symReader;
MetaData metaData; MetaData metaData;
public NDebugger Debugger { public Process Process {
get { get {
return debugger; return process;
} }
} }
@ -125,9 +125,9 @@ namespace Debugger
return corModule.GetFunctionFromToken(token); return corModule.GetFunctionFromToken(token);
} }
internal Module(NDebugger debugger, ICorDebugModule pModule) internal Module(Process process, ICorDebugModule pModule)
{ {
this.debugger = debugger; this.process = process;
corModule = pModule; corModule = pModule;

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/ModuleEventArgs.cs

@ -20,7 +20,7 @@ namespace Debugger
} }
} }
public ModuleEventArgs(Module module): base(module.Debugger) public ModuleEventArgs(Module module): base(module.Process)
{ {
this.module = module; this.module = module;
} }

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/NDebugger-Modules.cs → src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/Process-Modules.cs

@ -12,7 +12,7 @@ using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {
public partial class NDebugger public partial class Process
{ {
int lastAssignedModuleOrderOfLoading= 0; int lastAssignedModuleOrderOfLoading= 0;

12
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs

@ -16,7 +16,7 @@ namespace Debugger
{ {
public class Exception: RemotingObjectBase public class Exception: RemotingObjectBase
{ {
NDebugger debugger; Process process;
Thread thread; Thread thread;
ICorDebugValue corValue; ICorDebugValue corValue;
Value runtimeValue; Value runtimeValue;
@ -28,23 +28,23 @@ namespace Debugger
string type; string type;
string message; string message;
public NDebugger Debugger { public Process Process {
get { get {
return debugger; return process;
} }
} }
internal Exception(Thread thread) internal Exception(Thread thread)
{ {
creationTime = DateTime.Now; creationTime = DateTime.Now;
this.debugger = thread.Debugger; this.process = thread.Process;
this.thread = thread; this.thread = thread;
corValue = thread.CorThread.CurrentException; corValue = thread.CorThread.CurrentException;
exceptionType = thread.CurrentExceptionType; exceptionType = thread.CurrentExceptionType;
runtimeValue = new Variable(debugger, runtimeValue = new Variable(process,
"$exception", "$exception",
Variable.Flags.Default, Variable.Flags.Default,
new IExpirable[] {debugger.PauseSession}, new IExpirable[] {process.PauseSession},
new IMutable[] {}, new IMutable[] {},
delegate { return corValue; } ).Value; delegate { return corValue; } ).Value;
runtimeValueException = ((ObjectValue)runtimeValue).GetClass("System.Exception"); runtimeValueException = ((ObjectValue)runtimeValue).GetClass("System.Exception");

38
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

@ -18,7 +18,7 @@ namespace Debugger
{ {
public class Function: RemotingObjectBase, IExpirable public class Function: RemotingObjectBase, IExpirable
{ {
NDebugger debugger; Process process;
Module module; Module module;
ICorDebugFunction corFunction; ICorDebugFunction corFunction;
@ -33,9 +33,9 @@ namespace Debugger
MethodProps methodProps; MethodProps methodProps;
public NDebugger Debugger { public Process Process {
get { get {
return debugger; return process;
} }
} }
@ -99,7 +99,7 @@ namespace Debugger
{ {
if (!steppedOut) { if (!steppedOut) {
steppedOut = true; steppedOut = true;
debugger.TraceMessage("Function " + this.ToString() + " expired"); process.TraceMessage("Function " + this.ToString() + " expired");
if (Expired != null) { if (Expired != null) {
Expired(this, e); Expired(this, e);
} }
@ -108,12 +108,12 @@ namespace Debugger
internal Function(Thread thread, FrameID frameID, ICorDebugILFrame corILFrame) internal Function(Thread thread, FrameID frameID, ICorDebugILFrame corILFrame)
{ {
this.debugger = thread.Debugger; this.process = thread.Process;
this.thread = thread; this.thread = thread;
this.frameID = frameID; this.frameID = frameID;
this.CorILFrame = corILFrame; this.CorILFrame = corILFrame;
corFunction = corILFrame.Function; corFunction = corILFrame.Function;
module = debugger.GetModule(corFunction.Module); module = process.GetModule(corFunction.Module);
methodProps = module.MetaData.GetMethodProps(corFunction.Token); methodProps = module.MetaData.GetMethodProps(corFunction.Token);
@ -122,7 +122,7 @@ namespace Debugger
stepOutStepper.StepOut(); stepOutStepper.StepOut();
stepOutStepper.PauseWhenComplete = false; stepOutStepper.PauseWhenComplete = false;
debugger.TraceMessage("Function " + this.ToString() + " created"); process.TraceMessage("Function " + this.ToString() + " created");
} }
public override string ToString() public override string ToString()
@ -133,7 +133,7 @@ namespace Debugger
internal ICorDebugILFrame CorILFrame { internal ICorDebugILFrame CorILFrame {
get { get {
if (HasExpired) throw new DebuggerException("Function has expired"); if (HasExpired) throw new DebuggerException("Function has expired");
if (corILFramePauseSession != debugger.PauseSession) { if (corILFramePauseSession != process.PauseSession) {
CorILFrame = thread.GetFrameAt(frameID).As<ICorDebugILFrame>(); CorILFrame = thread.GetFrameAt(frameID).As<ICorDebugILFrame>();
} }
return corILFrame; return corILFrame;
@ -141,7 +141,7 @@ namespace Debugger
set { set {
if (value == null) throw new DebuggerException("Can not set frame to null"); if (value == null) throw new DebuggerException("Can not set frame to null");
corILFrame = value; corILFrame = value;
corILFramePauseSession = debugger.PauseSession; corILFramePauseSession = process.PauseSession;
} }
} }
@ -188,7 +188,7 @@ namespace Debugger
public void StepOut() public void StepOut()
{ {
new Stepper(this, "Function step out").StepOut(); new Stepper(this, "Function step out").StepOut();
debugger.Continue(); process.Continue();
} }
private unsafe void Step(bool stepIn) private unsafe void Step(bool stepIn)
@ -213,7 +213,7 @@ namespace Debugger
new Stepper(this, "Function step over").StepOver(nextSt.StepRanges); new Stepper(this, "Function step over").StepOver(nextSt.StepRanges);
} }
debugger.Continue(); process.Continue();
} }
/// <summary> /// <summary>
@ -326,7 +326,7 @@ namespace Debugger
SourcecodeSegment SetIP(bool simulate, string filename, int line, int column) SourcecodeSegment SetIP(bool simulate, string filename, int line, int column)
{ {
debugger.AssertPaused(); process.AssertPaused();
SourcecodeSegment suggestion = new SourcecodeSegment(filename, line, column, column); SourcecodeSegment suggestion = new SourcecodeSegment(filename, line, column, column);
ICorDebugFunction corFunction; ICorDebugFunction corFunction;
@ -343,8 +343,8 @@ namespace Debugger
} else { } else {
// invalidates all frames and chains for the current thread // invalidates all frames and chains for the current thread
CorILFrame.SetIP((uint)ilOffset); CorILFrame.SetIP((uint)ilOffset);
debugger.SelectedProcess.NotifyPaused(new PauseSession(PausedReason.SetIP)); process.SelectedProcess.NotifyPaused(new PauseSession(PausedReason.SetIP));
debugger.Pause(false); process.Pause(false);
} }
} catch { } catch {
return null; return null;
@ -378,7 +378,7 @@ namespace Debugger
public Variable ThisVariable { public Variable ThisVariable {
get { get {
return new Variable(debugger, return new Variable(process,
"this", "this",
Variable.Flags.Default, Variable.Flags.Default,
new IExpirable[] {this}, new IExpirable[] {this},
@ -435,11 +435,11 @@ namespace Debugger
public Variable GetArgumentVariable(int index) public Variable GetArgumentVariable(int index)
{ {
return new Variable(debugger, return new Variable(process,
GetParameterName(index), GetParameterName(index),
Variable.Flags.Default, Variable.Flags.Default,
new IExpirable[] {this}, new IExpirable[] {this},
new IMutable[] {debugger.DebugeeState}, new IMutable[] {process.DebugeeState},
delegate { return GetArgumentCorValue(index); } ); delegate { return GetArgumentCorValue(index); } );
} }
@ -491,11 +491,11 @@ namespace Debugger
Variable GetLocalVariable(ISymUnmanagedVariable symVar) Variable GetLocalVariable(ISymUnmanagedVariable symVar)
{ {
return new Variable(debugger, return new Variable(process,
symVar.Name, symVar.Name,
Variable.Flags.Default, Variable.Flags.Default,
new IExpirable[] {this}, new IExpirable[] {this},
new IMutable[] {debugger.DebugeeState}, new IMutable[] {process.DebugeeState},
delegate { return GetCorValueOfLocalVariable(symVar); }); delegate { return GetCorValueOfLocalVariable(symVar); });
} }

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Threads.cs → src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process-Threads.cs

@ -12,7 +12,7 @@ using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {
public partial class NDebugger public partial class Process
{ {
List<Thread> threadCollection = new List<Thread>(); List<Thread> threadCollection = new List<Thread>();

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs

@ -14,7 +14,7 @@ using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {
public class Process: RemotingObjectBase, IExpirable public partial class Process: RemotingObjectBase, IExpirable
{ {
NDebugger debugger; NDebugger debugger;

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Stepper.cs

@ -23,9 +23,9 @@ namespace Debugger
public event EventHandler<StepperEventArgs> StepComplete; public event EventHandler<StepperEventArgs> StepComplete;
public NDebugger Debugger { public Process Process {
get { get {
return function.Debugger; return function.Process;
} }
} }

25
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs

@ -16,13 +16,12 @@ namespace Debugger
{ {
public partial class Thread: RemotingObjectBase public partial class Thread: RemotingObjectBase
{ {
NDebugger debugger; Process process;
ICorDebugThread corThread; ICorDebugThread corThread;
internal ExceptionType currentExceptionType; internal ExceptionType currentExceptionType;
Process process;
List<Stepper> steppers = new List<Stepper>(); List<Stepper> steppers = new List<Stepper>();
uint id; uint id;
@ -33,9 +32,9 @@ namespace Debugger
Function selectedFunction; Function selectedFunction;
public NDebugger Debugger { public Process Process {
get { get {
return debugger; return process;
} }
} }
@ -64,25 +63,19 @@ namespace Debugger
} }
} }
public Process Process {
get {
return process;
}
}
public ICorDebugThread CorThread { public ICorDebugThread CorThread {
get { get {
return corThread; return corThread;
} }
} }
internal Thread(NDebugger debugger, ICorDebugThread corThread) internal Thread(Process process, ICorDebugThread corThread)
{ {
this.debugger = debugger; this.process = process;
this.corThread = corThread; this.corThread = corThread;
id = corThread.ID; id = corThread.ID;
this.process = debugger.GetProcess(corThread.Process); this.process = process.GetProcess(corThread.Process);
} }
public bool Suspended { public bool Suspended {
@ -114,10 +107,10 @@ namespace Debugger
if (!HasBeenLoaded) throw new DebuggerException("Thread has not started jet"); if (!HasBeenLoaded) throw new DebuggerException("Thread has not started jet");
process.AssertPaused(); process.AssertPaused();
return new Variable(debugger, return new Variable(process,
"thread" + id, "thread" + id,
Variable.Flags.Default, Variable.Flags.Default,
new IExpirable[] {debugger.PauseSession}, new IExpirable[] {process.PauseSession},
new IMutable[] {}, new IMutable[] {},
delegate { return corThread.Object;} ).Value; delegate { return corThread.Object;} ).Value;
} }
@ -238,7 +231,7 @@ namespace Debugger
// See docs\Stepping.txt // See docs\Stepping.txt
internal void CheckExpirationOfFunctions() internal void CheckExpirationOfFunctions()
{ {
if (debugger.Evaluating) return; if (process.Evaluating) return;
ICorDebugChainEnum corChainEnum = corThread.EnumerateChains(); ICorDebugChainEnum corChainEnum = corThread.EnumerateChains();
uint maxChainIndex = corChainEnum.Count - 1; uint maxChainIndex = corChainEnum.Count - 1;

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/ThreadEventArgs.cs

@ -20,7 +20,7 @@ namespace Debugger
} }
} }
public ThreadEventArgs(Thread thread): base(thread.Debugger) public ThreadEventArgs(Thread thread): base(thread.Process)
{ {
this.thread = thread; this.thread = thread;
} }

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/CallFunctionEval.cs

@ -20,8 +20,8 @@ namespace Debugger
Variable thisValue; Variable thisValue;
Variable[] args; Variable[] args;
public CallFunctionEval(NDebugger debugger, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies, ICorDebugFunction corFunction, Variable thisValue, Variable[] args) public CallFunctionEval(Process process, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies, ICorDebugFunction corFunction, Variable thisValue, Variable[] args)
:base(debugger, name, flags, expireDependencies, mutateDependencies) :base(process, name, flags, expireDependencies, mutateDependencies)
{ {
this.corFunction = corFunction; this.corFunction = corFunction;
this.thisValue = thisValue; this.thisValue = thisValue;

30
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs

@ -53,8 +53,8 @@ namespace Debugger
} }
} }
protected Eval(NDebugger debugger, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies) protected Eval(Process process, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies)
:base(debugger, name, flags, expireDependencies, mutateDependencies, null) :base(process, name, flags, expireDependencies, mutateDependencies, null)
{ {
} }
@ -71,20 +71,20 @@ namespace Debugger
this.currentState = currentState; this.currentState = currentState;
this.currentErrorMsg = currentErrorMsg; this.currentErrorMsg = currentErrorMsg;
this.currentCorValue = currentCorValue; this.currentCorValue = currentCorValue;
this.currentCorValuePauseSession = debugger.PauseSession; this.currentCorValuePauseSession = process.PauseSession;
OnChanged(new EvalEventArgs(this)); OnChanged(new EvalEventArgs(this));
} }
/// <summary> /// <summary>
/// Synchronously calls a function and returns its return value /// Synchronously calls a function and returns its return value
/// </summary> /// </summary>
public static Variable CallFunction(NDebugger debugger, Type type, string functionName, Variable thisValue, Variable[] args) public static Variable CallFunction(Process process, Type type, string functionName, Variable thisValue, Variable[] args)
{ {
string moduleName = System.IO.Path.GetFileName(type.Assembly.Location); string moduleName = System.IO.Path.GetFileName(type.Assembly.Location);
Module module = debugger.GetModule(moduleName); Module module = process.GetModule(moduleName);
string containgType = type.FullName; string containgType = type.FullName;
ICorDebugFunction corFunction = module.GetMethod(containgType, functionName, args.Length); ICorDebugFunction corFunction = module.GetMethod(containgType, functionName, args.Length);
return new CallFunctionEval(debugger, return new CallFunctionEval(process,
"Function call: " + containgType + "." + functionName, "Function call: " + containgType + "." + functionName,
Variable.Flags.Default, Variable.Flags.Default,
new IExpirable[] {}, new IExpirable[] {},
@ -97,9 +97,9 @@ namespace Debugger
/// <summary> /// <summary>
/// Synchronously creates a new string /// Synchronously creates a new string
/// </summary> /// </summary>
public static Variable NewString(NDebugger debugger, string textToCreate) public static Variable NewString(Process process, string textToCreate)
{ {
return new NewStringEval(debugger, return new NewStringEval(process,
"New string: " + textToCreate, "New string: " + textToCreate,
Variable.Flags.Default, Variable.Flags.Default,
new IExpirable[] {}, new IExpirable[] {},
@ -110,9 +110,9 @@ namespace Debugger
/// <summary> /// <summary>
/// Synchronously creates a new object /// Synchronously creates a new object
/// </summary> /// </summary>
public static Variable NewObject(NDebugger debugger, ICorDebugClass classToCreate) public static Variable NewObject(Process process, ICorDebugClass classToCreate)
{ {
return new NewObjectEval(debugger, return new NewObjectEval(process,
"New object: " + classToCreate.Token, "New object: " + classToCreate.Token,
Variable.Flags.Default, Variable.Flags.Default,
new IExpirable[] {}, new IExpirable[] {},
@ -138,8 +138,8 @@ namespace Debugger
public void ScheduleEvaluation() public void ScheduleEvaluation()
{ {
if (Evaluated || State == EvalState.WaitingForRequest) { if (Evaluated || State == EvalState.WaitingForRequest) {
debugger.ScheduleEval(this); process.ScheduleEval(this);
debugger.MTA2STA.AsyncCall(delegate { debugger.StartEvaluation(); }); process.MTA2STA.AsyncCall(delegate { process.StartEvaluation(); });
SetState(EvalState.EvaluationScheduled, null, null); SetState(EvalState.EvaluationScheduled, null, null);
} }
} }
@ -147,7 +147,7 @@ namespace Debugger
/// <returns>True if setup was successful</returns> /// <returns>True if setup was successful</returns>
internal bool SetupEvaluation(Thread targetThread) internal bool SetupEvaluation(Thread targetThread)
{ {
debugger.AssertPaused(); process.AssertPaused();
try { try {
if (targetThread.IsLastFunctionNative) { if (targetThread.IsLastFunctionNative) {
@ -181,8 +181,8 @@ namespace Debugger
{ {
while (State == EvalState.WaitingForRequest) { while (State == EvalState.WaitingForRequest) {
ScheduleEvaluation(); ScheduleEvaluation();
debugger.WaitForPause(); process.WaitForPause();
debugger.WaitForPause(); process.WaitForPause();
} }
return this; return this;
} }

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/EvalEventArgs.cs

@ -20,7 +20,7 @@ namespace Debugger
} }
} }
public EvalEventArgs(Eval eval): base(eval.Debugger) public EvalEventArgs(Eval eval): base(eval.Process)
{ {
this.eval = eval; this.eval = eval;
} }

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/NewObjectEval.cs

@ -18,8 +18,8 @@ namespace Debugger
{ {
ICorDebugClass classToCreate; ICorDebugClass classToCreate;
public NewObjectEval(NDebugger debugger, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies, ICorDebugClass classToCreate) public NewObjectEval(Process process, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies, ICorDebugClass classToCreate)
:base(debugger, name, flags, expireDependencies, mutateDependencies) :base(process, name, flags, expireDependencies, mutateDependencies)
{ {
this.classToCreate = classToCreate; this.classToCreate = classToCreate;
} }

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/NewStringEval.cs

@ -18,8 +18,8 @@ namespace Debugger
{ {
string textToCreate; string textToCreate;
public NewStringEval(NDebugger debugger, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies, string textToCreate) public NewStringEval(Process process, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies, string textToCreate)
:base(debugger, name, flags, expireDependencies, mutateDependencies) :base(process, name, flags, expireDependencies, mutateDependencies)
{ {
this.textToCreate = textToCreate; this.textToCreate = textToCreate;
} }

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/NDebugger-Evals.cs → src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Process-Evals.cs

@ -12,7 +12,7 @@ using Debugger.Wrappers.CorDebug;
namespace Debugger namespace Debugger
{ {
public partial class NDebugger public partial class Process
{ {
List<Eval> activeEvals = new List<Eval>(); List<Eval> activeEvals = new List<Eval>();
Queue<Eval> pendingEvalsCollection = new Queue<Eval>(); Queue<Eval> pendingEvalsCollection = new Queue<Eval>();

24
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectValueClass.cs

@ -18,7 +18,7 @@ namespace Debugger
{ {
public class ObjectValueClass: RemotingObjectBase public class ObjectValueClass: RemotingObjectBase
{ {
NDebugger debugger; Process process;
ObjectValue objectValue; ObjectValue objectValue;
@ -64,9 +64,9 @@ namespace Debugger
public ObjectValueClass(ObjectValue objectValue, ICorDebugClass corClass) public ObjectValueClass(ObjectValue objectValue, ICorDebugClass corClass)
{ {
this.debugger = objectValue.Debugger; this.process = objectValue.Debugger;
this.objectValue = objectValue; this.objectValue = objectValue;
this.module = debugger.GetModule(corClass.Module); this.module = process.GetModule(corClass.Module);
this.corClass = corClass; this.corClass = corClass;
this.classProps = Module.MetaData.GetTypeDefProps(corClass.Token); this.classProps = Module.MetaData.GetTypeDefProps(corClass.Token);
} }
@ -123,7 +123,7 @@ namespace Debugger
public ObjectValueClass BaseClass { public ObjectValueClass BaseClass {
get { get {
ICorDebugClass superClass = GetSuperClass(debugger, corClass); ICorDebugClass superClass = GetSuperClass(process, corClass);
if (superClass != null) { if (superClass != null) {
return new ObjectValueClass(objectValue, superClass); return new ObjectValueClass(objectValue, superClass);
} else { } else {
@ -137,7 +137,7 @@ namespace Debugger
foreach(FieldProps f in Module.MetaData.EnumFields(ClassToken)) { foreach(FieldProps f in Module.MetaData.EnumFields(ClassToken)) {
FieldProps field = f; // One per scope/delegate FieldProps field = f; // One per scope/delegate
if (field.IsStatic && field.IsLiteral) continue; // Skip field if (field.IsStatic && field.IsLiteral) continue; // Skip field
yield return new Variable(debugger, yield return new Variable(process,
field.Name, field.Name,
(field.IsStatic ? Variable.Flags.Static : Variable.Flags.None) | (field.IsStatic ? Variable.Flags.Static : Variable.Flags.None) |
(field.IsPublic ? Variable.Flags.Public : Variable.Flags.None), (field.IsPublic ? Variable.Flags.Public : Variable.Flags.None),
@ -153,8 +153,8 @@ namespace Debugger
// Current frame is used to resolve context specific static values (eg. ThreadStatic) // Current frame is used to resolve context specific static values (eg. ThreadStatic)
ICorDebugFrame curFrame = null; ICorDebugFrame curFrame = null;
if (debugger.IsPaused && debugger.SelectedThread != null && debugger.SelectedThread.LastFunction != null && debugger.SelectedThread.LastFunction.CorILFrame != null) { if (process.IsPaused && process.SelectedThread != null && process.SelectedThread.LastFunction != null && process.SelectedThread.LastFunction.CorILFrame != null) {
curFrame = debugger.SelectedThread.LastFunction.CorILFrame.CastTo<ICorDebugFrame>(); curFrame = process.SelectedThread.LastFunction.CorILFrame.CastTo<ICorDebugFrame>();
} }
try { try {
@ -181,11 +181,11 @@ namespace Debugger
if (method.HasSpecialName && method.Name.StartsWith("get_") && method.Name != "get_Item") { if (method.HasSpecialName && method.Name.StartsWith("get_") && method.Name != "get_Item") {
Variable.Flags flags = (method.IsStatic ? Variable.Flags.Static : Variable.Flags.None) | Variable.Flags flags = (method.IsStatic ? Variable.Flags.Static : Variable.Flags.None) |
(method.IsPublic ? Variable.Flags.Public : Variable.Flags.None); (method.IsPublic ? Variable.Flags.Public : Variable.Flags.None);
yield return new CallFunctionEval(debugger, yield return new CallFunctionEval(process,
method.Name.Remove(0, 4), method.Name.Remove(0, 4),
flags, flags,
new IExpirable[] {this.objectValue.Variable}, new IExpirable[] {this.objectValue.Variable},
new IMutable[] {debugger.DebugeeState}, new IMutable[] {process.DebugeeState},
Module.CorModule.GetFunctionFromToken(method.Token), Module.CorModule.GetFunctionFromToken(method.Token),
method.IsStatic ? null : this.objectValue.Variable, // this method.IsStatic ? null : this.objectValue.Variable, // this
new Variable[] {}); // args new Variable[] {}); // args
@ -193,9 +193,9 @@ namespace Debugger
} }
} }
protected static ICorDebugClass GetSuperClass(NDebugger debugger, ICorDebugClass currClass) protected static ICorDebugClass GetSuperClass(Process process, ICorDebugClass currClass)
{ {
Module currModule = debugger.GetModule(currClass.Module); Module currModule = process.GetModule(currClass.Module);
uint superToken = currModule.MetaData.GetTypeDefProps(currClass.Token).SuperClassToken; uint superToken = currModule.MetaData.GetTypeDefProps(currClass.Token).SuperClassToken;
// It has no base class // It has no base class
@ -210,7 +210,7 @@ namespace Debugger
if ((superToken & 0xFF000000) == 0x01000000) { if ((superToken & 0xFF000000) == 0x01000000) {
string fullTypeName = currModule.MetaData.GetTypeRefProps(superToken).Name; string fullTypeName = currModule.MetaData.GetTypeRefProps(superToken).Name;
foreach (Module superModule in debugger.Modules) { foreach (Module superModule in process.Modules) {
// TODO: Does not work for nested // TODO: Does not work for nested
// TODO: preservesig // TODO: preservesig
try { try {

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs

@ -17,9 +17,9 @@ namespace Debugger
{ {
Variable variable; Variable variable;
public NDebugger Debugger { public Process Process {
get { get {
return variable.Debugger; return variable.Process;
} }
} }

18
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs

@ -41,7 +41,7 @@ namespace Debugger
public enum Flags { Default = Public, None = 0, Public = 1, Static = 2, PublicStatic = Public | Static}; public enum Flags { Default = Public, None = 0, Public = 1, Static = 2, PublicStatic = Public | Static};
protected NDebugger debugger; protected Process process;
string name; string name;
Flags flags; Flags flags;
@ -57,9 +57,9 @@ namespace Debugger
public event EventHandler Expired; public event EventHandler Expired;
public event EventHandler<DebuggerEventArgs> Changed; public event EventHandler<DebuggerEventArgs> Changed;
public NDebugger Debugger { public Process Process {
get { get {
return debugger; return process;
} }
} }
@ -81,9 +81,9 @@ namespace Debugger
protected virtual ICorDebugValue RawCorValue { protected virtual ICorDebugValue RawCorValue {
get { get {
if (this.HasExpired) throw new CannotGetValueException("CorValue has expired"); if (this.HasExpired) throw new CannotGetValueException("CorValue has expired");
if (currentCorValue == null || (currentCorValuePauseSession != debugger.PauseSession && !currentCorValue.Is<ICorDebugHandleValue>())) { if (currentCorValue == null || (currentCorValuePauseSession != process.PauseSession && !currentCorValue.Is<ICorDebugHandleValue>())) {
currentCorValue = corValueGetter(); currentCorValue = corValueGetter();
currentCorValuePauseSession = debugger.PauseSession; currentCorValuePauseSession = process.PauseSession;
} }
return currentCorValue; return currentCorValue;
} }
@ -146,9 +146,9 @@ namespace Debugger
} }
} }
public Variable(NDebugger debugger, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies, CorValueGetter corValueGetter) public Variable(Process process, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies, CorValueGetter corValueGetter)
{ {
this.debugger = debugger; this.process = process;
this.name = name; this.name = name;
if (name.StartsWith("<") && name.Contains(">") && name != "<Base class>") { if (name.StartsWith("<") && name.Contains(">") && name != "<Base class>") {
string middle = name.TrimStart('<').Split('>')[0]; // Get text between '<' and '>' string middle = name.TrimStart('<').Split('>')[0]; // Get text between '<' and '>'
@ -161,7 +161,7 @@ namespace Debugger
foreach(IExpirable exp in expireDependencies) { foreach(IExpirable exp in expireDependencies) {
AddExpireDependency(exp); AddExpireDependency(exp);
} }
AddExpireDependency(debugger.SelectedProcess); AddExpireDependency(process.SelectedProcess);
this.mutateDependencies = mutateDependencies; this.mutateDependencies = mutateDependencies;
if (!this.HasExpired) { if (!this.HasExpired) {
@ -310,7 +310,7 @@ namespace Debugger
if (corValue.Is<ICorDebugReferenceValue>()) { if (corValue.Is<ICorDebugReferenceValue>()) {
if (newCorValue.Is<ICorDebugObjectValue>()) { if (newCorValue.Is<ICorDebugObjectValue>()) {
ICorDebugClass corClass = newCorValue.As<ICorDebugObjectValue>().Class; ICorDebugClass corClass = newCorValue.As<ICorDebugObjectValue>().Class;
ICorDebugValue box = Eval.NewObject(debugger, corClass).RawCorValue; ICorDebugValue box = Eval.NewObject(process, corClass).RawCorValue;
newCorValue = box; newCorValue = box;
} }
corValue.CastTo<ICorDebugReferenceValue>().SetValue(newCorValue.CastTo<ICorDebugReferenceValue>().Value); corValue.CastTo<ICorDebugReferenceValue>().SetValue(newCorValue.CastTo<ICorDebugReferenceValue>().Value);

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableEventArgs.cs

@ -19,7 +19,7 @@ namespace Debugger
} }
} }
public VariableEventArgs(Variable variable): base(variable.Debugger) public VariableEventArgs(Variable variable): base(variable.Process)
{ {
this.variable = variable; this.variable = variable;
} }

Loading…
Cancel
Save