Browse Source

Started getting of local variables for boo

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1656 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 19 years ago
parent
commit
262c2dadec
  1. 1
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Debugger.BooInterpreter.csproj
  2. 36
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Src/DebugeeInteractiveInterpreter.cs
  3. 48
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Src/DebugeeInterpreterContext.cs
  4. 21
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs

1
src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Debugger.BooInterpreter.csproj

@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration\AssemblyInfo.cs" />

36
src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Src/DebugeeInteractiveInterpreter.cs

@ -22,15 +22,31 @@ namespace Debugger @@ -22,15 +22,31 @@ namespace Debugger
base.Declare(name, type);
}
public object localVariable;
void DoCommand(string command, string param)
{
System.Diagnostics.Debugger.Log(0xB00, command, param);
}
public override object GetValue(string name)
{
System.Diagnostics.Debugger.Log(0xB00, "DebugeeInterpreterContext.BeforeGetValue", name);
return base.GetValue(name);
DoCommand("DebugeeInterpreterContext.BeforeGetValue", name);
object locVar = localVariable;
if (locVar != null) {
localVariable = null;
return locVar;
} else {
return base.GetValue(name);
}
}
public object GetValueInternal(string name)
public override object SetValue(string name, object val)
{
return base.GetValue(name);
localVariable = val;
DoCommand("DebugeeInterpreterContext.BeforeSetValue", name);
localVariable = null;
return base.SetValue(name, val);
}
public override Type Lookup(string name)
@ -42,17 +58,5 @@ namespace Debugger @@ -42,17 +58,5 @@ namespace Debugger
{
base.SetLastValue(val);
}
public override object SetValue(string name, object val)
{
object ret = base.SetValue(name, val);
System.Diagnostics.Debugger.Log(0xB00, "DebugeeInterpreterContext.AfterSetValue", name);
return ret;
}
public object SetValueInternal(string name, object val)
{
return base.SetValue(name, val);
}
}
}

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

@ -24,6 +24,7 @@ namespace Debugger @@ -24,6 +24,7 @@ namespace Debugger
{
NDebugger debugger;
Variable interpreter;
Variable interpreter_localVariable;
public DebugeeInterpreterContext()
{
@ -66,6 +67,7 @@ namespace Debugger @@ -66,6 +67,7 @@ namespace Debugger
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_localVariable = interpreter.Value.SubVariables["localVariable"];
RunCommand(
"import System\n" +
"import System.IO\n" +
@ -117,8 +119,8 @@ namespace Debugger @@ -117,8 +119,8 @@ namespace Debugger
case "DebugeeInterpreterContext.BeforeGetValue":
BeforeGetValue(e.Message);
break;
case "DebugeeInterpreterContext.AfterSetValue":
AfterSetValue(e.Message);
case "DebugeeInterpreterContext.BeforeSetValue":
BeforeSetValue(e.Message);
break;
}
}
@ -126,34 +128,38 @@ namespace Debugger @@ -126,34 +128,38 @@ namespace Debugger
void BeforeGetValue(string name)
{
// PrintLine("BeforeGetValue: " + name);
Variable localVar;
try {
Variable localVar = debugger.LocalVariables[name];
PrintLine("Warning: 'Getting of local variables not implemented'");
localVar = debugger.LocalVariables[name];
} catch (DebuggerException) {
return;
}
PrintLine("Getting local variable " + name);
// First, get out of GC unsafe point
Stepper stepOut = new Stepper(debugger.SelectedThread.LastFunction, "Boo interperter");
stepOut.PauseWhenComplete = true;
stepOut.StepComplete += delegate {
debugger.MTA2STA.AsyncCall(delegate {
if (!interpreter_localVariable.SetValue(localVar)) {
PrintLine("Getting of local variable " + name + " failed");
}
debugger.SkipEventsDuringEvaluation = true;
});
};
debugger.SkipEventsDuringEvaluation = false;
stepOut.StepOut();
}
void AfterSetValue(string name)
void BeforeSetValue(string name)
{
//PrintLine("AfterSetValue: " + name);
Variable localVar;
try {
Variable localVar = debugger.LocalVariables[name];
PrintLine("Warning: 'Setting of local variables not implemented'");
localVar = debugger.LocalVariables[name];
} catch (DebuggerException) {
return;
}
}
void SetValueInternal(string valueName, Variable newValue)
{
Variable name = Eval.NewString(debugger, valueName).Result;
Eval.CallFunction(debugger, typeof(DebugeeInteractiveInterpreter), "SetValueInternal", false, interpreter, new Variable[] {name, newValue}).ScheduleEvaluation();
}
Variable GetValueInternal(string valueName)
{
Variable name = Eval.NewString(debugger, valueName).EvaluateNow();
return Eval.CallFunction(debugger, typeof(DebugeeInteractiveInterpreter), "GetValueInternal", false, interpreter, new Variable[] {name}).EvaluateNow();
PrintLine("Setting local variable " + name);
localVar.SetValue(interpreter_localVariable);
}
}
}

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

@ -269,6 +269,27 @@ namespace Debugger @@ -269,6 +269,27 @@ namespace Debugger
}
}
public bool SetValue(Variable newVariable)
{
ICorDebugValue corValue = this.RawCorValue;
ICorDebugValue newCorValue = newVariable.RawCorValue;
if (newCorValue.Type == (uint)CorElementType.BYREF) {
newCorValue = newCorValue.As<ICorDebugReferenceValue>().Dereference();
}
if (corValue.Is<ICorDebugReferenceValue>()) {
if (newCorValue.Is<ICorDebugObjectValue>()) {
ICorDebugClass corClass = newCorValue.As<ICorDebugObjectValue>().Class;
ICorDebugValue box = Eval.NewObject(debugger, corClass).EvaluateNow().RawCorValue;
newCorValue = box;
}
corValue.CastTo<ICorDebugReferenceValue>().SetValue(newCorValue.CastTo<ICorDebugReferenceValue>().Value);
return true;
} else {
return false;
}
}
public VariableCollection GetDebugInfo()
{
return GetDebugInfo(this.RawCorValue);

Loading…
Cancel
Save