Browse Source

Properties shown in local variables pad and debugger tooltip

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@769 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
cfb9283bee
  1. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs
  2. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs
  3. 9
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  4. 8
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs
  5. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/NDebugger-Evals.cs
  6. 18
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/PropertyVariable.cs
  7. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

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

@ -39,7 +39,7 @@ namespace Debugger
this.debugger = debugger; this.debugger = debugger;
} }
bool HandlingCallback { public bool HandlingCallback {
get { get {
return handlingCallback; return handlingCallback;
} }
@ -220,7 +220,7 @@ namespace Debugger
} }
if (debugger.PendingEvals.Count > 0) { if (debugger.PendingEvals.Count > 0) {
debugger.SetupNextEvaluation(); debugger.SetupNextEvaluation(debugger.GetThread(pThread));
ExitCallback_Continue(); ExitCallback_Continue();
} else { } else {
ExitCallback_Paused(PausedReason.AllEvalsComplete); ExitCallback_Paused(PausedReason.AllEvalsComplete);

10
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs

@ -148,8 +148,16 @@ namespace Debugger
OnDebuggingPaused(reason); OnDebuggingPaused(reason);
if (IsPaused) { // OnDebuggingPaused can resume the debugger // Debugger state is unknown after calling OnDebuggingPaused (it may be resumed)
// This is a good point to autmaticaly evaluate evals from update of variables (if there are any)
if (IsPaused) {
localVariables.Update(); localVariables.Update();
this.StartEvaluation();
// Evaluation loop stoped by Function.GetPropertyVariables not adding evals
// And PropertyVariable not setting new value
}
if (IsPaused) {
waitForPauseHandle.Set(); waitForPauseHandle.Set();
} }
} }

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

@ -366,8 +366,8 @@ namespace Debugger
return VariableCollection.Merge( return VariableCollection.Merge(
GetContaingClassVariables(), GetContaingClassVariables(),
GetArgumentVariables(), GetArgumentVariables(),
GetLocalVariables() GetLocalVariables(),
//GetPropertyVariables() GetPropertyVariables()
); );
} }
@ -456,7 +456,10 @@ namespace Debugger
evalArgs = new ICorDebugValue[] {ThisValue.CorValue}; evalArgs = new ICorDebugValue[] {ThisValue.CorValue};
} }
Eval eval = new Eval(debugger, evalCorFunction, evalArgs); Eval eval = new Eval(debugger, evalCorFunction, evalArgs);
debugger.AddEval(eval); // Do not add evals if we just evaluated them, otherwise we get infinite loop
if (debugger.PausedReason != PausedReason.AllEvalsComplete) {
debugger.AddEval(eval);
}
properties.Add(new PropertyVariable(eval, method.Name.Remove(0, 4))); properties.Add(new PropertyVariable(eval, method.Name.Remove(0, 4)));
} }
} }

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

@ -28,7 +28,7 @@ namespace Debugger
bool evaluating = false; bool evaluating = false;
bool completed = false; bool completed = false;
Value result; Value result;
public event EventHandler<EvalEventArgs> EvalStarted; public event EventHandler<EvalEventArgs> EvalStarted;
public event EventHandler<EvalEventArgs> EvalComplete; public event EventHandler<EvalEventArgs> EvalComplete;
@ -87,12 +87,12 @@ namespace Debugger
} }
/// <returns>True is setup was successful</returns> /// <returns>True is setup was successful</returns>
internal bool SetupEvaluation() internal bool SetupEvaluation(Thread targetThread)
{ {
debugger.AssertPaused(); if (!debugger.ManagedCallback.HandlingCallback) debugger.AssertPaused();
// TODO: What if this thread is not suitable? // TODO: What if this thread is not suitable?
debugger.CurrentThread.CorThread.CreateEval(out corEval); targetThread.CorThread.CreateEval(out corEval);
corEval.CallFunction(corFunction, (uint)args.Length, args); corEval.CallFunction(corFunction, (uint)args.Length, args);

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/NDebugger-Evals.cs

@ -80,10 +80,10 @@ namespace Debugger
} }
// return true if there was eval to setup and it was setup // return true if there was eval to setup and it was setup
internal bool SetupNextEvaluation() internal bool SetupNextEvaluation(Thread targetThread)
{ {
if (pendingEvalsCollection.Count > 0) { if (pendingEvalsCollection.Count > 0) {
return pendingEvalsCollection[0].SetupEvaluation(); return pendingEvalsCollection[0].SetupEvaluation(targetThread);
} else { } else {
return false; return false;
} }
@ -97,7 +97,7 @@ namespace Debugger
this.AssertPaused(); this.AssertPaused();
// TODO: Investigate other threads, are they alowed to run? // TODO: Investigate other threads, are they alowed to run?
if (SetupNextEvaluation()) { if (SetupNextEvaluation(CurrentThread)) {
this.Continue(); this.Continue();
return true; return true;
} else { } else {

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

@ -19,9 +19,7 @@ namespace Debugger
internal PropertyVariable(Eval eval, string name):base(eval.Debugger, null, name) internal PropertyVariable(Eval eval, string name):base(eval.Debugger, null, name)
{ {
this.eval = eval; this.Eval = eval;
eval.EvalStarted += EvalStarted;
eval.EvalComplete += EvalComplete;
} }
public bool IsEvaluated { public bool IsEvaluated {
@ -48,6 +46,20 @@ namespace Debugger
} }
} }
public Eval Eval {
get {
return eval;
}
set {
if (debugger.PausedReason != PausedReason.AllEvalsComplete) {
eval = value;
eval.EvalStarted += EvalStarted;
eval.EvalComplete += EvalComplete;
OnValueChanged();
}
}
}
void EvalStarted(object sender, EvalEventArgs args) void EvalStarted(object sender, EvalEventArgs args)
{ {
OnValueChanged(); OnValueChanged();

10
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

@ -157,10 +157,16 @@ namespace Debugger
foreach(Variable newVariable in newVariables) { foreach(Variable newVariable in newVariables) {
if (this.Contains(newVariable.Name)) { if (this.Contains(newVariable.Name)) {
Variable oldVariable = this[newVariable.Name];
// Update existing variable // Update existing variable
this[newVariable.Name].Value = newVariable.Value; if (oldVariable is PropertyVariable) {
Eval newEval = ((PropertyVariable)newVariable).Eval;
((PropertyVariable)oldVariable).Eval = newEval;
} else {
oldVariable.Value = newVariable.Value;
}
// Keep the variable in the list // Keep the variable in the list
toBeRemoved.Remove(this[newVariable.Name]); toBeRemoved.Remove(oldVariable);
} else { } else {
// Add new variable // Add new variable
this.Add(newVariable); this.Add(newVariable);

Loading…
Cancel
Save