Browse Source

Removed Debugger.BooInterpreter (it is superseded by the console)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5161 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 16 years ago
parent
commit
529110b90b
  1. 21
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Configuration/AssemblyInfo.cs
  2. 25
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Debugger.BooInterpreter.addin
  3. 93
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Debugger.BooInterpreter.csproj
  4. 11
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/PostBuildEvent.proj
  5. 62
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Src/DebugeeInteractiveInterpreter.cs
  6. 164
      src/AddIns/Misc/Debugger/Debugger.BooInterpreter/Project/Src/DebugeeInterpreterContext.cs

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

@ -1,21 +0,0 @@ @@ -1,21 +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.Reflection;
using System.Runtime.CompilerServices;
// 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: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

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

@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
<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>

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

@ -1,93 +0,0 @@ @@ -1,93 +0,0 @@
<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>False</Private>
</Reference>
<Reference Include="Boo.Lang">
<HintPath>..\..\..\..\BackendBindings\Boo\RequiredLibraries\Boo.Lang.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\DebugeeInterpreterContext.cs" />
<Compile Include="Src\DebugeeInteractiveInterpreter.cs" />
<Compile Include="..\..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
</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>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<Import Project="PostBuildEvent.proj" />
</Project>

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

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
<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>

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

@ -1,62 +0,0 @@ @@ -1,62 +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 Boo.Lang.Interpreter;
namespace Debugger
{
public class DebugeeInteractiveInterpreter: InteractiveInterpreter
{
public DebugeeInteractiveInterpreter()
{
}
public override void Declare(string name, Type type)
{
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)
{
DoCommand("DebugeeInterpreterContext.BeforeGetValue", name);
object locVar = localVariable;
if (locVar != null) {
localVariable = null;
return locVar;
} else {
return base.GetValue(name);
}
}
public override object SetValue(string name, object val)
{
localVariable = val;
DoCommand("DebugeeInterpreterContext.BeforeSetValue", name);
localVariable = null;
return base.SetValue(name, val);
}
public override Type Lookup(string name)
{
return base.Lookup(name);
}
public override void SetLastValue(object val)
{
base.SetLastValue(val);
}
}
}

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

@ -1,164 +0,0 @@ @@ -1,164 +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.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;
using ICSharpCode.SharpDevelop.Debugging;
namespace Debugger
{
public class DebugeeInterpreterContext: InterpreterContext
{
Process process;
Value interpreter;
Value interpreter_localVariable;
public DebugeeInterpreterContext()
{
this.Title = "${res:ICSharpCode.BooInterpreter.Debuggee.Title}";
this.ToolTipText = "${res:ICSharpCode.BooInterpreter.Debuggee.ToolTip}";
this.Image = ICSharpCode.Core.ResourceService.GetBitmap("Boo.ProjectIcon");
}
bool CanLoadInterpreter {
get {
return interpreter != null || InjectInterpreter();
}
}
bool InjectInterpreter()
{
if (!DebuggerService.IsDebuggerLoaded) {
PrintLine(ResourceService.GetString("ICSharpCode.BooInterpreter.Debuggee.ErrorDebuggerNotLoaded"));
return false;
}
WindowsDebugger winDebugger = DebuggerService.CurrentDebugger as WindowsDebugger;
if (winDebugger == null) {
PrintLine(ResourceService.GetString("ICSharpCode.BooInterpreter.Debuggee.ErrorIncompatibleDebugger"));
return false;
}
if (winDebugger.DebuggedProcess == null) {
PrintLine(ResourceService.GetString("ICSharpCode.BooInterpreter.Debuggee.ErrorNoProgramDebugged"));
return false;
}
process = winDebugger.DebuggedProcess;
process.Expired += delegate { interpreter = null; };
process.LogMessage -= OnDebuggerLogMessage;
process.LogMessage += OnDebuggerLogMessage;
Value 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);
Value interpreterType = Eval.NewString(process, typeof(DebugeeInteractiveInterpreter).FullName);
interpreter = Eval.InvokeMethod(process, typeof(Assembly), "CreateInstance", assembly, new Value[] {interpreterType});
interpreter_localVariable = interpreter.GetMember("localVariable");
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;
}
Value LoadAssembly(string path)
{
Value assemblyPath = Eval.NewString(process, path);
Value assembly = Eval.InvokeMethod(process, typeof(Assembly), "LoadFrom", null, new Value[] {assemblyPath});
return assembly;
}
public override void RunCommand(string code)
{
if (CanLoadInterpreter) {
Value cmd = Eval.NewString(process, code);
Eval.InvokeMethod(process, typeof(InteractiveInterpreter), "LoopEval", interpreter, new Value[] {cmd});
}
}
public override string[] GetGlobals()
{
return null;
}
public override string[] SuggestCodeCompletion(string code)
{
if (CanLoadInterpreter) {
Value cmd = Eval.NewString(process, code);
Eval.InvokeMethod(process, typeof(AbstractInterpreter), "SuggestCodeCompletion", interpreter, new Value[] {cmd});
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.BeforeSetValue":
BeforeSetValue(e.Message);
break;
}
}
}
void BeforeGetValue(string name)
{
NamedValue localVar;
try {
localVar = process.LocalVariables[name];
} catch (DebuggerException) {
return;
}
PrintLine("Getting local variable " + name);
// First, get out of GC unsafe point
Stepper stepOut = new Stepper(process.SelectedThread.LastFunction, "Boo interperter");
stepOut.StepComplete += delegate {
process.Debugger.MTA2STA.AsyncCall(delegate {
if (!interpreter_localVariable.SetValue(localVar)) {
PrintLine("Getting of local variable " + name + " failed");
}
process.Continue();
});
};
stepOut.StepOut();
}
void BeforeSetValue(string name)
{
NamedValue localVar;
try {
localVar = process.LocalVariables[name];
} catch (DebuggerException) {
return;
}
PrintLine("Setting local variable " + name);
localVar.SetValue(interpreter_localVariable);
}
}
}
Loading…
Cancel
Save