Browse Source

Added Debugger.BooInterpreter

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1596 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 19 years ago
parent
commit
1bb8b5a11a
  1. 2
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin
  2. 26
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj
  3. 11
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/PostBuildEvent.proj
  4. 38
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Configuration/AssemblyInfo.cs
  5. 25
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Debugger.BooInterpreter.addin
  6. 87
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Debugger.BooInterpreter.csproj
  7. 11
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/PostBuildEvent.proj
  8. 58
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Src/DebugeeInteractiveInterpreter.cs
  9. 157
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Src/DebugeeInterpreterContext.cs
  10. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  11. 84
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Boo/InterpreterWrapper.cs
  12. 23
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/DebuggerEvents/MessageEventArgs.cs
  13. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs
  14. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
  15. 7
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs
  16. 9
      src/SharpDevelop.sln

2
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin

@ -5,6 +5,8 @@ @@ -5,6 +5,8 @@
<Runtime>
<Import assembly="Debugger.AddIn.dll"/>
<Import assembly="Debugger.Core.dll"/>
<Import assembly="TreeListView.dll"/>
</Runtime>
<Path name="/SharpDevelop/Services/DebuggerService/Debugger">

26
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj

@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -40,15 +41,6 @@ @@ -40,15 +41,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="Client.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Debugger.AddIn.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Server.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\Pads\BreakPointsPad.cs" />
<Compile Include="Src\Pads\CallStackPad.cs" />
@ -77,6 +69,15 @@ @@ -77,6 +69,15 @@
<Compile Include="Src\Pads\DebuggerTreeListView.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Client.config">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Include="Debugger.AddIn.addin">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Include="Server.config">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<ProjectReference Include="..\..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project>
<Name>ICSharpCode.TextEditor</Name>
@ -95,13 +96,16 @@ @@ -95,13 +96,16 @@
<ProjectReference Include="..\..\Debugger.Core\Project\Debugger.Core.csproj">
<Project>{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}</Project>
<Name>Debugger.Core</Name>
<Private>True</Private>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</ProjectReference>
<ProjectReference Include="..\..\TreeListView\Project\TreeListView.csproj">
<Project>{B08385CD-F0CC-488C-B4F4-EEB34B6D2688}</Project>
<Name>TreeListView</Name>
<Private>False</Private>
</ProjectReference>
<Content Include="PostBuildEvent.proj" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>
<Import Project="PostBuildEvent.proj" />
</Project>

11
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/PostBuildEvent.proj

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);MyPostBuildTarget</PrepareForRunDependsOn>
</PropertyGroup>
<ItemGroup>
<MyCopyItem Include="$(MSBuildProjectDirectory)\*.addin" />
</ItemGroup>
<Target Name="MyPostBuildTarget">
<Copy SourceFiles="@(MyCopyItem)" DestinationFolder="$(OutputPath)" />
</Target>
</Project>

38
src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Configuration/AssemblyInfo.cs

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
// <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.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("Debugger.BooInterpreter")]
[assembly: AssemblyDescription("Boo Interpreter for debugger")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Debugger.BooInterpreter")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.*")]

25
src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Debugger.BooInterpreter.addin

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
<AddIn name = "Debugger Boo Interpreter"
author = "David Srbecký"
copyright = "prj:///doc/copyright.txt"
description = "Interactive boo interpreter run in debugee">
<Manifest>
<Identity name = "ICSharpCode.DebuggerBooInterpreter"/>
<Dependency addin = "ICSharpCode.BooInterpreter"/>
<Dependency addin = "ICSharpCode.Debugger"/>
</Manifest>
<Runtime>
<Import assembly = "Debugger.BooInterpreter.dll"/>
<Import assembly = "$ICSharpCode.BooInterpreter/Boo.Lang.dll"/>
<Import assembly = "$ICSharpCode.BooInterpreter/Boo.Lang.Compiler.dll"/>
<Import assembly = "$ICSharpCode.BooInterpreter/Boo.Lang.Interpreter.dll"/>
<Import assembly = "$ICSharpCode.BooInterpreter/Boo.InterpreterAddIn.dll"/>
<Import assembly = "$ICSharpCode.Debugger/Debugger.AddIn.dll"/>
<Import assembly = "$ICSharpCode.Debugger/Debugger.Core.dll"/>
</Runtime>
<Path name="/AddIns/InterpreterAddIn/InterpreterContexts">
<Class id="Debugee" class="Debugger.DebugeeInterpreterContext"/>
</Path>
</AddIn>

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

@ -0,0 +1,87 @@ @@ -0,0 +1,87 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Debugger</RootNamespace>
<AssemblyName>Debugger.BooInterpreter</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B45B39B9-620C-4F84-A555-1833790517AB}</ProjectGuid>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<OutputPath>..\..\..\..\..\..\AddIns\AddIns\Misc\Debugger</OutputPath>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Drawing" />
<Reference Include="Boo.Lang.Interpreter">
<HintPath>..\..\..\..\BackendBindings\Boo\RequiredLibraries\Boo.Lang.Interpreter.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private>True</Private>
</Reference>
<Reference Include="Boo.Lang">
<HintPath>..\..\..\..\BackendBindings\Boo\RequiredLibraries\Boo.Lang.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\DebugeeInterpreterContext.cs" />
<Compile Include="Src\DebugeeInteractiveInterpreter.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Src" />
<Folder Include="Configuration" />
<Content Include="Debugger.BooInterpreter.addin">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<ProjectReference Include="..\..\Debugger.Core\Project\Debugger.Core.csproj">
<Project>{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}</Project>
<Name>Debugger.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\BackendBindings\Boo\Boo.InterpreterAddIn\Project\Boo.InterpreterAddIn.booproj">
<Project>{928E34B2-5E46-4A4D-8E4D-2CA2CCDB905A}</Project>
<Name>Boo.InterpreterAddIn</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Debugger.AddIn\Project\Debugger.AddIn.csproj">
<Project>{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}</Project>
<Name>Debugger.AddIn</Name>
<Private>False</Private>
</ProjectReference>
<Content Include="PostBuildEvent.proj" />
<ProjectReference Include="..\..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<Import Project="PostBuildEvent.proj" />
</Project>

11
src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/PostBuildEvent.proj

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);MyPostBuildTarget</PrepareForRunDependsOn>
</PropertyGroup>
<ItemGroup>
<MyCopyItem Include="$(MSBuildProjectDirectory)\*.addin" />
</ItemGroup>
<Target Name="MyPostBuildTarget">
<Copy SourceFiles="@(MyCopyItem)" DestinationFolder="$(OutputPath)" />
</Target>
</Project>

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

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
// <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 Boo.Lang.Interpreter;
namespace Debugger
{
public class DebugeeInteractiveInterpreter: InteractiveInterpreter
{
public DebugeeInteractiveInterpreter()
{
}
public override void Declare(string name, Type type)
{
base.Declare(name, type);
}
public override object GetValue(string name)
{
System.Diagnostics.Debugger.Log(0xB00, "DebugeeInterpreterContext.BeforeGetValue", name);
return base.GetValue(name);
}
public object GetValueInternal(string name)
{
return base.GetValue(name);
}
public override Type Lookup(string name)
{
return base.Lookup(name);
}
public override void SetLastValue(object val)
{
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);
}
}
}

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

@ -0,0 +1,157 @@ @@ -0,0 +1,157 @@
// <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.IO;
using System.Reflection;
using Boo.Lang.Interpreter;
using Boo.InterpreterAddIn;
using Debugger.Wrappers.CorDebug;
using Debugger.Wrappers.MetaData;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Services;
namespace Debugger
{
public class DebugeeInterpreterContext: InterpreterContext
{
NDebugger debugger;
Variable interpreter;
public DebugeeInterpreterContext()
{
this.Title = "Debuggee";
this.ToolTipText = "Runs commands in the debugged progam";
this.Image = ICSharpCode.Core.ResourceService.GetBitmap("Boo.ProjectIcon");
}
bool CanLoadInterpreter {
get {
return interpreter != null || InjectInterpreter();
}
}
bool InjectInterpreter()
{
if (!DebuggerService.IsDebuggerLoaded) {
PrintLine("Error: 'Debugger is not loaded'");
return false;
}
WindowsDebugger winDebugger = DebuggerService.CurrentDebugger as WindowsDebugger;
if (winDebugger == null) {
PrintLine("Error: 'Incompatible debugger'");
return false;
}
if (!winDebugger.IsDebugging) {
PrintLine("Error: 'No program is debugged'");
return false;
}
debugger = winDebugger.DebuggerCore;
debugger.SelectedProcess.Expired += delegate { interpreter = null; };
debugger.LogMessage -= OnDebuggerLogMessage;
debugger.LogMessage += OnDebuggerLogMessage;
Variable assembly;
// Boo.Lang.Interpreter.dll
string path = Path.Combine(Path.GetDirectoryName(typeof(InterpreterContext).Assembly.Location), "Boo.Lang.Interpreter.dll");
assembly = LoadAssembly(path);
// 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();
RunCommand(
"import System\n" +
"import System.IO\n" +
"import System.Text\n" +
"interpreter.RememberLastValue = true\n" +
"interpreter.Print = def(msg): System.Diagnostics.Debugger.Log(0xB00, \"DebugeeInterpreterContext.PrintLine\", msg)");
return true;
}
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();
return assembly;
}
public override void RunCommand(string code)
{
if (CanLoadInterpreter) {
Variable cmd = Eval.NewString(debugger, code).EvaluateNow();
Eval.CallFunction(debugger, typeof(InteractiveInterpreter), "LoopEval", false, interpreter, new Variable[] {cmd}).EvaluateNow();
}
}
public override string[] GetGlobals()
{
return null;
}
public override string[] SuggestCodeCompletion(string code)
{
if (CanLoadInterpreter) {
Variable cmd = Eval.NewString(debugger, code).EvaluateNow();
Eval.CallFunction(debugger, typeof(AbstractInterpreter), "SuggestCodeCompletion", false, interpreter, new Variable[] {cmd}).EvaluateNow();
return null;
} else {
return null;
}
}
void OnDebuggerLogMessage(object sender, MessageEventArgs e)
{
if (e.Level == 0xB00 && interpreter != null) {
switch (e.Category) {
case "DebugeeInterpreterContext.PrintLine":
PrintLine(e.Message);
break;
case "DebugeeInterpreterContext.BeforeGetValue":
BeforeGetValue(e.Message);
break;
case "DebugeeInterpreterContext.AfterSetValue":
AfterSetValue(e.Message);
break;
}
}
}
void BeforeGetValue(string name)
{
// PrintLine("BeforeGetValue: " + name);
Variable localVar = debugger.LocalVariables[name];
if (localVar != null) {
PrintLine("Warning: 'Getting of local variables not implemented'");
}
}
void AfterSetValue(string name)
{
//PrintLine("AfterSetValue: " + name);
Variable localVar = debugger.LocalVariables[name];
if (localVar != null) {
PrintLine("Warning: 'Setting of local variables not implemented'");
}
}
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();
}
}
}

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

@ -377,7 +377,6 @@ @@ -377,7 +377,6 @@
<Compile Include="Src\Wrappers\CorDebug\ICorDebugFrame.cs" />
<Compile Include="Src\Variables\VariableEventArgs.cs" />
<Compile Include="Src\Debugger\IExpirable.cs" />
<Compile Include="Src\Boo\InterpreterWrapper.cs" />
<Compile Include="Src\Variables\Evals\Eval.CallFunctionEval.cs" />
<Compile Include="Src\Variables\Evals\Eval.NewStringEval.cs" />
<Compile Include="Src\Variables\Variable.cs" />
@ -394,7 +393,6 @@ @@ -394,7 +393,6 @@
<Folder Include="Src\Wrappers\MetaData" />
<Folder Include="docs" />
<Content Include="docs\Stepping.txt" />
<Folder Include="Src\Boo" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>

84
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Boo/InterpreterWrapper.cs

@ -1,84 +0,0 @@ @@ -1,84 +0,0 @@
/*
* Created by SharpDevelop.
* User: User
* Date: 10/07/2006
* Time: 01:47
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using Debugger.Wrappers.CorDebug;
using Debugger.Wrappers.MetaData;
namespace Debugger
{
public class InterpreterWrapper
{
const string booDll = "Boo.Lang.Interpreter.dll";
NDebugger debugger;
Variable interpreter;
public NDebugger Debugger {
get {
return debugger;
}
}
public static InterpreterWrapper InjectBooInterpreter(NDebugger debugger, string booPath)
{
return new InterpreterWrapper(debugger, booPath);
}
private InterpreterWrapper(NDebugger debugger, string booInterpreterPath)
{
this.debugger = debugger;
Variable assemblyPath = Eval.NewString(debugger, booInterpreterPath).EvaluateNow();
Variable assembly = Eval.CallFunction(debugger, "mscorlib.dll", "System.Reflection.Assembly", "LoadFrom", false, null, new Variable[] {assemblyPath}).EvaluateNow();
Variable interpreterType = Eval.NewString(debugger, "Boo.Lang.Interpreter.InteractiveInterpreter").EvaluateNow();
interpreter = Eval.CallFunction(debugger, "mscorlib.dll", "System.Reflection.Assembly", "CreateInstance", false, assembly, new Variable[] {interpreterType}).EvaluateNow();
RunCommand("interpreter.RememberLastValue = true");
// Testing:
RunCommand("1 + 2");
Variable res = GetLastValue();
SetValue("a", res);
RunCommand("a = a + 100");
Variable a = GetValue("a");
Variable sug = SuggestCodeCompletion("interpreter.__codecomplete__");
}
public void RunCommand(string code)
{
Variable cmd = Eval.NewString(debugger, code).EvaluateNow();
Eval.CallFunction(debugger, booDll, "Boo.Lang.Interpreter.InteractiveInterpreter", "LoopEval", false, interpreter, new Variable[] {cmd}).EvaluateNow();
}
public void SetValue(string valueName, Variable newValue)
{
Variable name = Eval.NewString(debugger, valueName).EvaluateNow();
Eval.CallFunction(debugger, booDll, "Boo.Lang.Interpreter.InteractiveInterpreter", "SetValue", false, interpreter, new Variable[] {name, newValue}).EvaluateNow();
}
public Variable GetValue(string valueName)
{
Variable name = Eval.NewString(debugger, valueName).EvaluateNow();
return Eval.CallFunction(debugger, booDll, "Boo.Lang.Interpreter.InteractiveInterpreter", "GetValue", false, interpreter, new Variable[] {name}).EvaluateNow();
}
public Variable GetLastValue()
{
return Eval.CallFunction(debugger, booDll, "Boo.Lang.Interpreter.InteractiveInterpreter", "get_LastValue", false, interpreter, new Variable[] {}).EvaluateNow();
}
public Variable SuggestCodeCompletion(string code)
{
Variable cmd = Eval.NewString(debugger, code).EvaluateNow();
return Eval.CallFunction(debugger, booDll, "Boo.Lang.Interpreter.AbstractInterpreter", "SuggestCodeCompletion", false, interpreter, new Variable[] {cmd}).EvaluateNow();
}
}
}

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

@ -12,7 +12,15 @@ namespace Debugger @@ -12,7 +12,15 @@ namespace Debugger
[Serializable]
public class MessageEventArgs : DebuggerEventArgs
{
int level;
string message;
string category;
public int Level {
get {
return level;
}
}
public string Message {
get {
@ -20,9 +28,22 @@ namespace Debugger @@ -20,9 +28,22 @@ namespace Debugger
}
}
public MessageEventArgs(NDebugger debugger, string message): base(debugger)
public string Category {
get {
return category;
}
}
public MessageEventArgs(NDebugger debugger, string message): this(debugger, 0, message, String.Empty)
{
this.message = message;
}
public MessageEventArgs(NDebugger debugger, int level, string message, string category): base(debugger)
{
this.level = level;
this.message = message;
this.category = category;
}
}
}

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

@ -205,7 +205,7 @@ namespace Debugger @@ -205,7 +205,7 @@ namespace Debugger
{
EnterCallback(PausedReason.Other, "LogMessage", pThread);
debugger.OnLogMessage(pMessage);
debugger.OnLogMessage(new MessageEventArgs(debugger, lLevel, pMessage, pLogSwitchName));
ExitCallback_Continue();
}

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs

@ -150,11 +150,11 @@ namespace Debugger @@ -150,11 +150,11 @@ namespace Debugger
/// </summary>
public event EventHandler<MessageEventArgs> LogMessage;
protected internal virtual void OnLogMessage(string message)
protected internal virtual void OnLogMessage(MessageEventArgs arg)
{
TraceMessage ("Debugger event: OnLogMessage");
if (LogMessage != null) {
LogMessage(this, new MessageEventArgs(this, message));
LogMessage(this, arg);
}
}

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

@ -97,6 +97,13 @@ namespace Debugger @@ -97,6 +97,13 @@ namespace Debugger
}
}
public static Eval CallFunction(NDebugger debugger, Type type, string functionName, bool reevaluateAfterDebuggeeStateChange, Variable thisValue, Variable[] args)
{
string moduleName = System.IO.Path.GetFileName(type.Assembly.Location);
string containgType = type.FullName;
return new CallFunctionEval(debugger, moduleName, containgType, functionName, reevaluateAfterDebuggeeStateChange, thisValue, args);
}
public static Eval CallFunction(NDebugger debugger, string moduleName, string containgType, string functionName, bool reevaluateAfterDebuggeeStateChange, Variable thisValue, Variable[] args)
{
return new CallFunctionEval(debugger, moduleName, containgType, functionName, reevaluateAfterDebuggeeStateChange, thisValue, args);

9
src/SharpDevelop.sln

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.1.0.1472
# SharpDevelop 2.1.0.1532
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
@ -84,6 +84,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debugger", "Debugger", "{66 @@ -84,6 +84,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debugger", "Debugger", "{66
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.BooInterpreter", "AddIns\Misc\Debugger\Debugger.BooInterpreter\Project\Debugger.BooInterpreter.csproj", "{B45B39B9-620C-4F84-A555-1833790517AB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.AddIn", "AddIns\Misc\Debugger\Debugger.AddIn\Project\Debugger.AddIn.csproj", "{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Core", "AddIns\Misc\Debugger\Debugger.Core\Project\Debugger.Core.csproj", "{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}"
@ -310,6 +312,10 @@ Global @@ -310,6 +312,10 @@ Global
{000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD}.Release|Any CPU.Build.0 = Release|Any CPU
{000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B45B39B9-620C-4F84-A555-1833790517AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B45B39B9-620C-4F84-A555-1833790517AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B45B39B9-620C-4F84-A555-1833790517AB}.Release|Any CPU.Build.0 = Release|Any CPU
{B45B39B9-620C-4F84-A555-1833790517AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{CE5B42B7-6E8C-4385-9E97-F4023FC16BF2} = {14A277EE-7DF1-4529-B639-7D1EF334C1C5}
@ -354,6 +360,7 @@ Global @@ -354,6 +360,7 @@ Global
{B08385CD-F0CC-488C-B4F4-EEB34B6D2688} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{B45B39B9-620C-4F84-A555-1833790517AB} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}

Loading…
Cancel
Save