Browse Source

Eval derives from Variable

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1675 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 19 years ago
parent
commit
34d59c3315
  1. 8
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Src/DebugeeInterpreterContext.cs
  2. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  3. 55
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/CallFunctionEval.cs
  4. 109
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.CallFunctionEval.cs
  5. 57
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.NewObjectEval.cs
  6. 57
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.NewStringEval.cs
  7. 169
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs
  8. 32
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/NewObjectEval.cs
  9. 32
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/NewStringEval.cs
  10. 20
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectValueClass.cs
  11. 11
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs

8
src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Src/DebugeeInterpreterContext.cs

@ -66,7 +66,7 @@ namespace Debugger @@ -66,7 +66,7 @@ namespace Debugger
// Debugger.BooInterpreter.dll
assembly = LoadAssembly(typeof(DebugeeInteractiveInterpreter).Assembly.Location);
Variable interpreterType = Eval.NewString(debugger, typeof(DebugeeInteractiveInterpreter).FullName).EvaluateNow();
interpreter = Eval.CallFunction(debugger, typeof(Assembly), "CreateInstance", false, assembly, new Variable[] {interpreterType}).EvaluateNow();
interpreter = Eval.CallFunction(debugger, typeof(Assembly), "CreateInstance", assembly, new Variable[] {interpreterType}).EvaluateNow();
interpreter_localVariable = interpreter.Value.SubVariables["localVariable"];
RunCommand(
"import System\n" +
@ -81,7 +81,7 @@ namespace Debugger @@ -81,7 +81,7 @@ namespace Debugger
Variable LoadAssembly(string path)
{
Variable assemblyPath = Eval.NewString(debugger, path).EvaluateNow();
Variable assembly = Eval.CallFunction(debugger, typeof(Assembly), "LoadFrom", false, null, new Variable[] {assemblyPath}).EvaluateNow();
Variable assembly = Eval.CallFunction(debugger, typeof(Assembly), "LoadFrom", null, new Variable[] {assemblyPath}).EvaluateNow();
return assembly;
}
@ -89,7 +89,7 @@ namespace Debugger @@ -89,7 +89,7 @@ namespace Debugger
{
if (CanLoadInterpreter) {
Variable cmd = Eval.NewString(debugger, code).EvaluateNow();
Eval.CallFunction(debugger, typeof(InteractiveInterpreter), "LoopEval", false, interpreter, new Variable[] {cmd}).EvaluateNow();
Eval.CallFunction(debugger, typeof(InteractiveInterpreter), "LoopEval", interpreter, new Variable[] {cmd}).EvaluateNow();
}
}
@ -102,7 +102,7 @@ namespace Debugger @@ -102,7 +102,7 @@ namespace Debugger
{
if (CanLoadInterpreter) {
Variable cmd = Eval.NewString(debugger, code).EvaluateNow();
Eval.CallFunction(debugger, typeof(AbstractInterpreter), "SuggestCodeCompletion", false, interpreter, new Variable[] {cmd}).EvaluateNow();
Eval.CallFunction(debugger, typeof(AbstractInterpreter), "SuggestCodeCompletion", interpreter, new Variable[] {cmd}).EvaluateNow();
return null;
} else {
return null;

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

@ -377,12 +377,12 @@ @@ -377,12 +377,12 @@
<Compile Include="Src\Wrappers\CorDebug\ICorDebugFrame.cs" />
<Compile Include="Src\Variables\VariableEventArgs.cs" />
<Compile Include="Src\Debugger\IExpirable.cs" />
<Compile Include="Src\Variables\Evals\Eval.CallFunctionEval.cs" />
<Compile Include="Src\Variables\Evals\Eval.NewStringEval.cs" />
<Compile Include="Src\Variables\Evals\CallFunctionEval.cs" />
<Compile Include="Src\Variables\Evals\NewStringEval.cs" />
<Compile Include="Src\Variables\Variable.cs" />
<Compile Include="Src\Variables\ObjectValue.cs" />
<Compile Include="Src\Debugger\Util.cs" />
<Compile Include="Src\Variables\Evals\Eval.NewObjectEval.cs" />
<Compile Include="Src\Variables\Evals\NewObjectEval.cs" />
<Compile Include="Src\Debugger\IMutable.cs" />
</ItemGroup>
<ItemGroup>

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

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Debugger.Wrappers.CorDebug;
namespace Debugger
{
class CallFunctionEval: Eval
{
ICorDebugFunction corFunction;
Variable thisValue;
Variable[] args;
public CallFunctionEval(NDebugger debugger, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies, ICorDebugFunction corFunction, Variable thisValue, Variable[] args)
:base(debugger, name, flags, expireDependencies, mutateDependencies)
{
this.corFunction = corFunction;
this.thisValue = thisValue;
this.args = args;
}
protected override void StartEvaluation()
{
List<ICorDebugValue> corArgs = new List<ICorDebugValue>();
try {
if (thisValue != null) {
Value val = thisValue.Value;
if (!(val is ObjectValue)) {
throw new EvalSetartException("Can not evaluate on a value which is not an object");
}
if (!((ObjectValue)val).IsInClassHierarchy(corFunction.Class)) {
throw new EvalSetartException("Can not evaluate because the object does not contain specified function");
}
corArgs.Add(thisValue.SoftReference);
}
foreach(Variable arg in args) {
corArgs.Add(arg.SoftReference);
}
} catch (CannotGetValueException e) {
throw new EvalSetartException(e.Message);
}
corEval.CallFunction(corFunction, (uint)corArgs.Count, corArgs.ToArray());
}
}
}

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

@ -1,109 +0,0 @@ @@ -1,109 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Debugger.Wrappers.CorDebug;
namespace Debugger
{
public partial class Eval
{
class CallFunctionEval: Eval
{
string moduleName;
string containgType;
string functionName;
ICorDebugFunction corFunction;
Variable thisValue;
Variable[] args;
public CallFunctionEval(NDebugger debugger, string moduleName, string containgType, string functionName, bool reevaluateAfterDebuggeeStateChange, Variable thisValue, Variable[] args)
:this(debugger, null, reevaluateAfterDebuggeeStateChange, thisValue, args)
{
this.moduleName = moduleName;
this.containgType = containgType;
this.functionName = functionName;
}
public CallFunctionEval(NDebugger debugger, ICorDebugFunction corFunction, bool reevaluateAfterDebuggeeStateChange, Variable thisValue, Variable[] args)
:base(debugger, reevaluateAfterDebuggeeStateChange, thisValue == null? args : Util.MergeLists(new Variable[] {thisValue}, args).ToArray())
{
this.corFunction = corFunction;
this.thisValue = thisValue;
this.args = args;
}
internal override bool SetupEvaluation(Thread targetThread)
{
debugger.AssertPaused();
if (targetThread.IsLastFunctionNative) {
OnError("Can not evaluate because native frame is on top of stack");
return false;
}
if (corFunction == null) {
try {
Module module = debugger.GetModule(moduleName);
corFunction = module.GetMethod(containgType, functionName, args.Length);
} catch (DebuggerException) {
// Error thrown later on
}
}
List<ICorDebugValue> corArgs = new List<ICorDebugValue>();
try {
if (thisValue != null) {
Value val = thisValue.Value;
if (!(val is ObjectValue)) {
OnError("Can not evaluate on a value which is not an object");
return false;
}
if (corFunction != null && !((ObjectValue)val).IsInClassHierarchy(corFunction.Class)) {
OnError("Can not evaluate because the object does not contain specified function");
return false;
}
corArgs.Add(thisValue.SoftReference);
}
foreach(Variable arg in args) {
corArgs.Add(arg.SoftReference);
}
} catch (CannotGetValueException e) {
OnError(e.Message);
return false;
}
if (corFunction == null) {
OnError("Can not find or load function " + functionName);
return false;
}
// TODO: What if this thread is not suitable?
corEval = targetThread.CorThread.CreateEval();
try {
corEval.CallFunction(corFunction, (uint)corArgs.Count, corArgs.ToArray());
} catch (COMException e) {
if ((uint)e.ErrorCode == 0x80131C26) {
OnError("Can not evaluate in optimized code");
return false;
} else {
throw;
}
}
EvalState = EvalState.Evaluating;
return true;
}
}
}
}

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

@ -1,57 +0,0 @@ @@ -1,57 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Debugger.Wrappers.CorDebug;
namespace Debugger
{
public partial class Eval
{
class NewObjectEval: Eval
{
ICorDebugClass classToCreate;
public NewObjectEval(NDebugger debugger, ICorDebugClass classToCreate):base(debugger, false, new IExpirable[] {})
{
this.classToCreate = classToCreate;
}
internal override bool SetupEvaluation(Thread targetThread)
{
debugger.AssertPaused();
if (targetThread.IsLastFunctionNative) {
OnError("Can not evaluate because native frame is on top of stack");
return false;
}
// TODO: What if this thread is not suitable?
corEval = targetThread.CorThread.CreateEval();
try {
corEval.NewObjectNoConstructor(classToCreate);
} catch (COMException e) {
if ((uint)e.ErrorCode == 0x80131C26) {
OnError("Can not evaluate in optimized code");
return false;
} else {
throw;
}
}
EvalState = EvalState.Evaluating;
return true;
}
}
}
}

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

@ -1,57 +0,0 @@ @@ -1,57 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Debugger.Wrappers.CorDebug;
namespace Debugger
{
public partial class Eval
{
class NewStringEval: Eval
{
string textToCreate;
public NewStringEval(NDebugger debugger, string textToCreate):base(debugger, false, new IExpirable[] {})
{
this.textToCreate = textToCreate;
}
internal override bool SetupEvaluation(Thread targetThread)
{
debugger.AssertPaused();
if (targetThread.IsLastFunctionNative) {
OnError("Can not evaluate because native frame is on top of stack");
return false;
}
// TODO: What if this thread is not suitable?
corEval = targetThread.CorThread.CreateEval();
try {
corEval.NewString(textToCreate);
} catch (COMException e) {
if ((uint)e.ErrorCode == 0x80131C26) {
OnError("Can not evaluate in optimized code");
return false;
} else {
throw;
}
}
EvalState = EvalState.Evaluating;
return true;
}
}
}
}

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

@ -19,36 +19,25 @@ namespace Debugger @@ -19,36 +19,25 @@ namespace Debugger
/// <summary>
/// This class holds information about function evaluation.
/// </summary>
public abstract partial class Eval
public abstract partial class Eval: Variable
{
NDebugger debugger;
Variable variablele;
protected class EvalSetartException: System.Exception
{
public EvalSetartException(string msg):base(msg)
{
}
}
ICorDebugEval corEval;
bool reevaluateAfterDebuggeeStateChange;
protected ICorDebugEval corEval;
EvalState evalState = EvalState.WaitingForRequest;
ICorDebugValue result;
DebugeeState debugeeStateOfResult;
string error;
public NDebugger Debugger {
get {
return debugger;
}
}
public EvalState EvalState {
get {
return evalState;
}
protected set {
evalState = value;
if (Evaluated) {
debugeeStateOfResult = debugger.DebugeeState;
}
variablele.NotifyChange();
}
}
public bool Evaluated {
@ -60,78 +49,71 @@ namespace Debugger @@ -60,78 +49,71 @@ namespace Debugger
}
}
public Variable Result {
get {
return variablele;
}
}
internal ICorDebugEval CorEval {
get {
return corEval;
}
}
protected Eval(NDebugger debugger, bool reevaluateAfterDebuggeeStateChange, IExpirable[] dependencies)
protected Eval(NDebugger debugger, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies)
:base(debugger, name, flags, expireDependencies, mutateDependencies, null)
{
this.debugger = debugger;
this.reevaluateAfterDebuggeeStateChange = reevaluateAfterDebuggeeStateChange;
variablele = new Variable(debugger,
String.Empty,
Variable.Flags.Default,
dependencies,
reevaluateAfterDebuggeeStateChange? new IMutable[] {debugger.DebugeeState}: new IMutable[0],
delegate { return GetCorValue(); });
foreach(IExpirable dependency in dependencies) {
if (dependency is Variable) {
((Variable)dependency).Changed += delegate { EvalState = EvalState.WaitingForRequest; };
}
}
if (reevaluateAfterDebuggeeStateChange) {
debugger.DebuggeeStateChanged += delegate { EvalState = EvalState.WaitingForRequest; };
}
}
public static Eval CallFunction(NDebugger debugger, Type type, string functionName, bool reevaluateAfterDebuggeeStateChange, Variable thisValue, Variable[] args)
internal override void NotifyChange()
{
string moduleName = System.IO.Path.GetFileName(type.Assembly.Location);
string containgType = type.FullName;
return new CallFunctionEval(debugger, moduleName, containgType, functionName, reevaluateAfterDebuggeeStateChange, thisValue, args);
evalState = EvalState.WaitingForRequest;
base.NotifyChange();
}
public static Eval CallFunction(NDebugger debugger, string moduleName, string containgType, string functionName, bool reevaluateAfterDebuggeeStateChange, Variable thisValue, Variable[] args)
public static Eval CallFunction(NDebugger debugger, Type type, string functionName, Variable thisValue, Variable[] args)
{
return new CallFunctionEval(debugger, moduleName, containgType, functionName, reevaluateAfterDebuggeeStateChange, thisValue, args);
}
public static Eval CallFunction(NDebugger debugger, ICorDebugFunction corFunction, bool reevaluateAfterDebuggeeStateChange, Variable thisValue, Variable[] args)
{
return new CallFunctionEval(debugger, corFunction, reevaluateAfterDebuggeeStateChange, thisValue, args);
string moduleName = System.IO.Path.GetFileName(type.Assembly.Location);
Module module = debugger.GetModule(moduleName);
string containgType = type.FullName;
ICorDebugFunction corFunction = module.GetMethod(containgType, functionName, args.Length);
return new CallFunctionEval(debugger,
"Function call: " + containgType + "." + functionName,
Variable.Flags.Default,
new IExpirable[] {},
new IMutable[] {},
corFunction,
thisValue,
args);
}
public static Eval NewString(NDebugger debugger, string textToCreate)
{
return new NewStringEval(debugger, textToCreate);
return new NewStringEval(debugger,
"New string: " + textToCreate,
Variable.Flags.Default,
new IExpirable[] {},
new IMutable[] {},
textToCreate);
}
public static Eval NewObject(NDebugger debugger, ICorDebugClass classToCreate)
{
return new NewObjectEval(debugger, classToCreate);
return new NewObjectEval(debugger,
"New object: " + classToCreate.Token,
Variable.Flags.Default,
new IExpirable[] {},
new IMutable[] {},
classToCreate);
}
ICorDebugValue GetCorValue()
{
switch(this.EvalState) {
case EvalState.WaitingForRequest: ScheduleEvaluation(); goto case EvalState.EvaluationScheduled;
case EvalState.EvaluationScheduled: throw new CannotGetValueException("Evaluation pending");
case EvalState.Evaluating: throw new CannotGetValueException("Evaluating...");
case EvalState.EvaluatedSuccessfully: return result;
case EvalState.EvaluatedException: return result;
case EvalState.EvaluatedNoResult: throw new CannotGetValueException("No return value");
case EvalState.EvaluatedError: throw new CannotGetValueException(error);
default: throw new DebuggerException("Unknown state");
protected override ICorDebugValue RawCorValue {
get {
switch(this.EvalState) {
case EvalState.WaitingForRequest: ScheduleEvaluation(); goto case EvalState.EvaluationScheduled;
case EvalState.EvaluationScheduled: throw new CannotGetValueException("Evaluation pending");
case EvalState.Evaluating: throw new CannotGetValueException("Evaluating...");
case EvalState.EvaluatedSuccessfully: return result;
case EvalState.EvaluatedException: return result;
case EvalState.EvaluatedNoResult: throw new CannotGetValueException("No return value");
case EvalState.EvaluatedError: throw new CannotGetValueException(error);
default: throw new DebuggerException("Unknown state");
}
}
}
@ -139,12 +121,43 @@ namespace Debugger @@ -139,12 +121,43 @@ namespace Debugger
{
if (Evaluated || EvalState == EvalState.WaitingForRequest) {
debugger.PerformEval(this);
EvalState = EvalState.EvaluationScheduled;
evalState = EvalState.EvaluationScheduled;
OnChanged(new EvalEventArgs(this));
}
}
/// <returns>True if setup was successful</returns>
internal abstract bool SetupEvaluation(Thread targetThread);
internal bool SetupEvaluation(Thread targetThread)
{
debugger.AssertPaused();
if (targetThread.IsLastFunctionNative) {
OnError("Can not evaluate because native frame is on top of stack");
}
// TODO: What if this thread is not suitable?
corEval = targetThread.CorThread.CreateEval();
try {
StartEvaluation();
} catch (EvalSetartException e) {
OnError(e.Message);
return false;
} catch (COMException e) {
if ((uint)e.ErrorCode == 0x80131C26) {
OnError("Can not evaluate in optimized code");
return false;
} else {
throw;
}
}
evalState = EvalState.Evaluating;
return true;
}
protected abstract void StartEvaluation();
public Variable EvaluateNow()
{
@ -153,29 +166,35 @@ namespace Debugger @@ -153,29 +166,35 @@ namespace Debugger
debugger.WaitForPause();
debugger.WaitForPause();
}
return Result;
return this;
}
protected void OnError(string msg)
{
error = msg;
EvalState = EvalState.EvaluatedError;
result = null;
debugeeStateOfResult = debugger.DebugeeState;
evalState = EvalState.EvaluatedError;
OnChanged(new EvalEventArgs(this));
}
internal void NotifyEvaluationComplete(bool successful)
{
error = null;
// Eval result should be ICorDebugHandleValue so it should survive Continue()
result = corEval.Result;
debugeeStateOfResult = debugger.DebugeeState;
if (result == null) {
EvalState = EvalState.EvaluatedNoResult;
evalState = EvalState.EvaluatedNoResult;
} else {
if (successful) {
EvalState = EvalState.EvaluatedSuccessfully;
evalState = EvalState.EvaluatedSuccessfully;
} else {
EvalState = EvalState.EvaluatedException;
evalState = EvalState.EvaluatedException;
}
}
OnChanged(new EvalEventArgs(this));
}
}
}

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

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Debugger.Wrappers.CorDebug;
namespace Debugger
{
class NewObjectEval: Eval
{
ICorDebugClass classToCreate;
public NewObjectEval(NDebugger debugger, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies, ICorDebugClass classToCreate)
:base(debugger, name, flags, expireDependencies, mutateDependencies)
{
this.classToCreate = classToCreate;
}
protected override void StartEvaluation()
{
corEval.NewObjectNoConstructor(classToCreate);
}
}
}

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

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Debugger.Wrappers.CorDebug;
namespace Debugger
{
class NewStringEval: Eval
{
string textToCreate;
public NewStringEval(NDebugger debugger, string name, Flags flags, IExpirable[] expireDependencies, IMutable[] mutateDependencies, string textToCreate)
:base(debugger, name, flags, expireDependencies, mutateDependencies)
{
this.textToCreate = textToCreate;
}
protected override void StartEvaluation()
{
corEval.NewString(textToCreate);
}
}
}

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

@ -179,16 +179,16 @@ namespace Debugger @@ -179,16 +179,16 @@ namespace Debugger
foreach(MethodProps m in Methods) {
MethodProps method = m; // One per scope/delegate
if (method.HasSpecialName && method.Name.StartsWith("get_") && method.Name != "get_Item") {
Eval eval = Eval.CallFunction(debugger,
Module.CorModule.GetFunctionFromToken(method.Token),
true, // reevaluateAfterDebuggeeStateChange
method.IsStatic? null : this.objectValue.Variable,
new Variable[] {});
Variable var = eval.Result;
var.Name = method.Name.Remove(0, 4);
var.VariableFlags = (method.IsStatic ? Variable.Flags.Static : Variable.Flags.None) |
(method.IsPublic ? Variable.Flags.Public : Variable.Flags.None);
yield return var;
Variable.Flags flags = (method.IsStatic ? Variable.Flags.Static : Variable.Flags.None) |
(method.IsPublic ? Variable.Flags.Public : Variable.Flags.None);
yield return new CallFunctionEval(debugger,
method.Name.Remove(0, 4),
flags,
new IExpirable[] {this.objectValue.Variable},
new IMutable[] {debugger.DebugeeState},
Module.CorModule.GetFunctionFromToken(method.Token),
method.IsStatic ? null : this.objectValue.Variable, // this
new Variable[] {}); // args
}
}
}

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

@ -28,19 +28,17 @@ namespace Debugger @@ -28,19 +28,17 @@ namespace Debugger
/// <summary>
/// Delegate that is used to get value. This delegate may be called at any time and should never return null.
/// </summary>
public delegate Value ValueGetter();
public delegate ICorDebugValue CorValueGetter();
[Flags]
public enum Flags { Default = Public, None = 0, Public = 1, Static = 2, PublicStatic = Public | Static};
NDebugger debugger;
protected NDebugger debugger;
string name;
Flags flags;
CorValueGetter corValueGetter;
ValueGetter valueGetter;
IMutable[] mutateDependencies;
bool isExpired = false;
@ -69,7 +67,7 @@ namespace Debugger @@ -69,7 +67,7 @@ namespace Debugger
}
}
ICorDebugValue RawCorValue {
protected virtual ICorDebugValue RawCorValue {
get {
if (this.HasExpired) throw new CannotGetValueException("CorValue has expired");
return corValueGetter();
@ -79,7 +77,7 @@ namespace Debugger @@ -79,7 +77,7 @@ namespace Debugger
public Value Value {
get {
try {
return valueGetter();
return CreateValue();
} catch (CannotGetValueException e) {
return new UnavailableValue(this, e.Message);
}
@ -155,7 +153,6 @@ namespace Debugger @@ -155,7 +153,6 @@ namespace Debugger
}
this.corValueGetter = corValueGetter;
this.valueGetter = delegate { return CreateValue(); };
}
void AddExpireDependency(IExpirable dependency)
@ -188,7 +185,7 @@ namespace Debugger @@ -188,7 +185,7 @@ namespace Debugger
NotifyChange();
}
internal void NotifyChange()
internal virtual void NotifyChange()
{
if (!isExpired) {
OnChanged(new VariableEventArgs(this));

Loading…
Cancel
Save