Browse Source

Lazy getting of function arguments and local variables

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@830 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
41b3368ee2
  1. 16
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  2. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs
  3. 31
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs
  4. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

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

@ -456,7 +456,11 @@ namespace Debugger @@ -456,7 +456,11 @@ namespace Debugger
public Variable GetArgumentVariable(int index)
{
return new Variable(debugger, GetArgumentValue(index), GetParameterName(index));
return new Variable(debugger,
GetParameterName(index),
delegate {
return Value.CreateValue(debugger, GetArgumentValue(index));
});
}
public IEnumerable<Variable> ArgumentVariables {
@ -515,9 +519,13 @@ namespace Debugger @@ -515,9 +519,13 @@ namespace Debugger
Variable GetLocalVariable(ISymbolVariable symVar)
{
ICorDebugValue runtimeVar;
CorILFrame.GetLocalVariable((uint)symVar.AddressField1, out runtimeVar);
return new Variable(debugger, runtimeVar, symVar.Name);
return new Variable(debugger,
symVar.Name,
delegate {
ICorDebugValue corValue;
CorILFrame.GetLocalVariable((uint)symVar.AddressField1, out corValue);
return Value.CreateValue(debugger, corValue);
});
}
}
}

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

@ -254,7 +254,7 @@ namespace Debugger @@ -254,7 +254,7 @@ namespace Debugger
if (skipCount < 0) throw new ArgumentException("Chain index too big", "firstChainIndex");
corChainEnum.Skip((uint)skipCount);
chainIndex -= (uint)skipCount;
firstChainIndex = chainIndex;
firstChainIndex = chainIndex - 1;
}
while (true) {
@ -282,7 +282,6 @@ namespace Debugger @@ -282,7 +282,6 @@ namespace Debugger
if (skipCount < 0) throw new ArgumentException("Frame index too big", "firstFrameIndex");
corFrameEnum.Skip((uint)skipCount);
frameIndex -= (uint)skipCount;
firstFrameIndex = frameIndex;
}
while (true) {

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

@ -11,6 +11,8 @@ using Debugger.Interop.CorDebug; @@ -11,6 +11,8 @@ using Debugger.Interop.CorDebug;
namespace Debugger
{
public delegate Value ValueUpdatingEventHandler();
public class Variable: RemotingObjectBase
{
protected NDebugger debugger;
@ -19,6 +21,8 @@ namespace Debugger @@ -19,6 +21,8 @@ namespace Debugger
Value val;
VariableCollection subVariables;
event ValueUpdatingEventHandler updating;
public event EventHandler<VariableEventArgs> ValueChanged;
public event EventHandler<VariableCollectionEventArgs> ValueRemovedFromCollection;
@ -40,6 +44,9 @@ namespace Debugger @@ -40,6 +44,9 @@ namespace Debugger
public Value Value {
get {
Value v = GetValue();
if (v == null) {
return new UnavailableValue(debugger);
}
if (v.IsExpired) {
return new UnavailableValue(debugger, "The value has expired");
} else {
@ -55,6 +62,9 @@ namespace Debugger @@ -55,6 +62,9 @@ namespace Debugger
protected virtual Value GetValue()
{
if ((val == null || val.IsExpired) && updating != null) {
val = updating();
}
return val;
}
@ -97,16 +107,29 @@ namespace Debugger @@ -97,16 +107,29 @@ namespace Debugger
}
}
public Variable(NDebugger debugger, ICorDebugValue corValue, string name):this(Value.CreateValue(debugger, corValue), name)
public Variable(NDebugger debugger, ICorDebugValue corValue, string name):this(debugger, Value.CreateValue(debugger, corValue), name, null)
{
}
public Variable(NDebugger debugger, string name, ValueUpdatingEventHandler updating):this(debugger, null, name, updating)
{
}
public Variable(Value val, string name):this(val.Debugger, val, name, null)
{
}
public Variable(Value val, string name)
Variable(NDebugger debugger, Value val, string name, ValueUpdatingEventHandler updating)
{
this.debugger = val.Debugger;
this.Value = val;
this.debugger = debugger;
if (val != null) {
this.Value = val;
}
this.name = name;
this.updating = updating;
this.subVariables = new VariableCollection(debugger);
this.subVariables.Updating += OnSubVariablesUpdating;
}

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

@ -159,14 +159,14 @@ namespace Debugger @@ -159,14 +159,14 @@ namespace Debugger
if (this.Contains(newVariable.Name)) {
Variable oldVariable = this[newVariable.Name];
// Update existing variable
if (oldVariable.Value is ObjectValue && newVariable.Value is ObjectValue && debugger.PausedReason == PausedReason.AllEvalsComplete) {
/*if (oldVariable.Value is ObjectValue && newVariable.Value is ObjectValue && debugger.PausedReason == PausedReason.AllEvalsComplete) {
((ObjectValue)newVariable.Value).toString = ((ObjectValue)oldVariable.Value).toString;
}
if (oldVariable is PropertyVariable) {
((PropertyVariable)oldVariable).Eval = ((PropertyVariable)newVariable).Eval;
} else {
oldVariable.Value = newVariable.Value;
}
}*/
// Keep the variable in the list
toBeRemoved.Remove(oldVariable);
} else {

Loading…
Cancel
Save