Browse Source

Some cleanups

pull/191/merge
Eusebiu Marcu 14 years ago
parent
commit
45f62864e1
  1. 1
      Debugger/ILSpy.Debugger/ILSpy.Debugger.csproj
  2. 2
      Debugger/ILSpy.Debugger/Services/Debugger/DebuggerHelper.cs
  3. 188
      Debugger/ILSpy.Debugger/Services/Debugger/DefaultDebugger.cs
  4. 2
      Debugger/ILSpy.Debugger/Services/Debugger/ListHelper.cs
  5. 81
      Debugger/ILSpy.Debugger/Services/Debugger/RemotingConfigurationHelpper.cs
  6. 2
      Debugger/ILSpy.Debugger/Services/Debugger/TypeResolverExtension.cs
  7. 10
      Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs
  8. 4
      Debugger/ILSpy.Debugger/Services/ExtensionMethods.cs
  9. 8
      ILSpy.sln
  10. 2
      ILSpy/CSharpLanguage.cs
  11. 3
      ILSpy/ILLanguage.cs
  12. 6
      ILSpy/MainWindow.xaml.cs
  13. 1
      ILSpy/TreeNodes/MethodTreeNode.cs
  14. 1
      ILSpy/TreeNodes/PropertyTreeNode.cs
  15. 2
      ILSpy/TreeNodes/TypeTreeNode.cs

1
Debugger/ILSpy.Debugger/ILSpy.Debugger.csproj

@ -87,7 +87,6 @@ @@ -87,7 +87,6 @@
<Compile Include="Services\Debugger\DebuggerService.cs" />
<Compile Include="Services\Debugger\IDebugger.cs" />
<Compile Include="Services\Debugger\ListHelper.cs" />
<Compile Include="Services\Debugger\RemotingConfigurationHelpper.cs" />
<Compile Include="Services\Debugger\TypeResolverExtension.cs" />
<Compile Include="Services\Debugger\WindowsDebugger.cs" />
<Compile Include="Services\ExtensionMethods.cs" />

2
Debugger/ILSpy.Debugger/Services/Debugger/DebuggerHelper.cs

@ -12,7 +12,7 @@ using ICSharpCode.NRefactory.CSharp; @@ -12,7 +12,7 @@ using ICSharpCode.NRefactory.CSharp;
namespace ICSharpCode.ILSpy.Debugger.Services.Debugger
{
public static class DebuggerHelpers
static class DebuggerHelpers
{
/// <summary>
/// Creates an expression which, when evaluated, creates a List&lt;T&gt; in the debugee

188
Debugger/ILSpy.Debugger/Services/Debugger/DefaultDebugger.cs

@ -1,188 +0,0 @@ @@ -1,188 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Diagnostics;
using System.Threading;
using ICSharpCode.NRefactory;
namespace ILSpy.Debugger.Services
{
public class DefaultDebugger : IDebugger
{
Process attachedProcess = null;
public bool IsDebugging {
get {
return attachedProcess != null;
}
}
public bool IsProcessRunning {
get {
return IsDebugging;
}
}
/// <inheritdoc/>
public bool BreakAtBeginning {
get; set;
}
public void Start(ProcessStartInfo processStartInfo)
{
if (attachedProcess != null) {
return;
}
OnDebugStarting(EventArgs.Empty);
try {
attachedProcess = new Process();
attachedProcess.StartInfo = processStartInfo;
attachedProcess.Exited += new EventHandler(AttachedProcessExited);
attachedProcess.EnableRaisingEvents = true;
attachedProcess.Start();
OnDebugStarted(EventArgs.Empty);
} catch (Exception) {
OnDebugStopped(EventArgs.Empty);
throw new ApplicationException("Can't execute \"" + processStartInfo.FileName + "\"\n");
}
}
public void ShowAttachDialog()
{
}
public void Attach(Process process)
{
}
public void Detach()
{
}
void AttachedProcessExited(object sender, EventArgs e)
{
attachedProcess.Exited -= new EventHandler(AttachedProcessExited);
attachedProcess.Dispose();
attachedProcess = null;
OnDebugStopped(EventArgs.Empty);
}
public void StartWithoutDebugging(ProcessStartInfo processStartInfo)
{
Process.Start(processStartInfo);
}
public void Stop()
{
if (attachedProcess != null) {
attachedProcess.Exited -= new EventHandler(AttachedProcessExited);
attachedProcess.Kill();
attachedProcess.Close();
attachedProcess.Dispose();
attachedProcess = null;
}
}
// ExecutionControl:
public void Break()
{
throw new NotSupportedException();
}
public void Continue()
{
throw new NotSupportedException();
}
// Stepping:
public void StepInto()
{
throw new NotSupportedException();
}
public void StepOver()
{
throw new NotSupportedException();
}
public void StepOut()
{
throw new NotSupportedException();
}
/// <summary>
/// Gets the current value of the variable as string that can be displayed in tooltips.
/// </summary>
public string GetValueAsString(string variable)
{
return null;
}
/// <summary>
/// Gets the tooltip control that shows the value of given variable.
/// Return null if no tooltip is available.
/// </summary>
public object GetTooltipControl(Location logicalPosition, string variable)
{
return null;
}
public bool CanSetInstructionPointer(string filename, int line, int column)
{
return false;
}
public bool SetInstructionPointer(string filename, int line, int column)
{
return false;
}
public event EventHandler DebugStarted;
protected virtual void OnDebugStarted(EventArgs e)
{
if (DebugStarted != null) {
DebugStarted(this, e);
}
}
public event EventHandler IsProcessRunningChanged;
protected virtual void OnIsProcessRunningChanged(EventArgs e)
{
if (IsProcessRunningChanged != null) {
IsProcessRunningChanged(this, e);
}
}
public event EventHandler DebugStopped;
protected virtual void OnDebugStopped(EventArgs e)
{
if (DebugStopped != null) {
DebugStopped(this, e);
}
}
public event EventHandler DebugStarting;
protected virtual void OnDebugStarting(EventArgs e)
{
if (DebugStarting != null) {
DebugStarting(this, e);
}
}
public void Dispose()
{
Stop();
}
}
}

2
Debugger/ILSpy.Debugger/Services/Debugger/ListHelper.cs

@ -9,7 +9,7 @@ namespace ICSharpCode.ILSpy.Debugger.Services.Debugger @@ -9,7 +9,7 @@ namespace ICSharpCode.ILSpy.Debugger.Services.Debugger
/// ListHelper wraps System.Collection.Generic.List methods to return the original list,
/// instead of returning 'void', so we can write eg. list.Sorted().First()
/// </summary>
public static class ListHelper
static class ListHelper
{
public static List<T> Sorted<T>(this List<T> list, IComparer<T> comparer)
{

81
Debugger/ILSpy.Debugger/Services/Debugger/RemotingConfigurationHelpper.cs

@ -1,81 +0,0 @@ @@ -1,81 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using System.Reflection;
using System.Runtime.Remoting;
using System.Security.Policy;
namespace ICSharpCode.ILSpy.Debugger.Services.Debugger
{
[Serializable]
class RemotingConfigurationHelpper
{
public string path;
public RemotingConfigurationHelpper(string path)
{
this.path = path;
}
public static string GetLoadedAssemblyPath(string assemblyName)
{
string path = null;
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) {
try {
string fullFilename = assembly.Location;
if (Path.GetFileName(fullFilename).Equals(assemblyName, StringComparison.OrdinalIgnoreCase)) {
path = Path.GetDirectoryName(fullFilename);
break;
}
} catch (NotSupportedException) {
// assembly.Location throws NotSupportedException for assemblies emitted using
// Reflection.Emit by custom controls used in the forms designer
}
}
if (path == null) {
throw new Exception("Assembly " + assemblyName + " is not loaded");
}
return path;
}
public void Configure()
{
AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve;
RemotingConfiguration.Configure(Path.Combine(path, "Client.config"), false);
string baseDir = Directory.GetDirectoryRoot(AppDomain.CurrentDomain.BaseDirectory);
string relDirs = AppDomain.CurrentDomain.BaseDirectory + ";" + path;
AppDomain serverAppDomain = AppDomain.CreateDomain("Debugging server",
new Evidence(AppDomain.CurrentDomain.Evidence),
baseDir,
relDirs,
AppDomain.CurrentDomain.ShadowCopyFiles);
serverAppDomain.DoCallBack(new CrossAppDomainDelegate(ConfigureServer));
}
private void ConfigureServer()
{
AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve;
RemotingConfiguration.Configure(Path.Combine(path, "Server.config"), false);
}
Assembly AssemblyResolve(object sender, ResolveEventArgs args)
{
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) {
try {
string fullFilename = assembly.Location;
if (Path.GetFileNameWithoutExtension(fullFilename).Equals(args.Name, StringComparison.OrdinalIgnoreCase) ||
assembly.FullName == args.Name) {
return assembly;
}
} catch (NotSupportedException) {
// assembly.Location throws NotSupportedException for assemblies emitted using
// Reflection.Emit by custom controls used in the forms designer
}
}
return null;
}
}
}

2
Debugger/ILSpy.Debugger/Services/Debugger/TypeResolverExtension.cs

@ -11,7 +11,7 @@ namespace ICSharpCode.ILSpy.Debugger.Services.Debugger @@ -11,7 +11,7 @@ namespace ICSharpCode.ILSpy.Debugger.Services.Debugger
/// <summary>
/// Helper for obtaining information about DebugType.
/// </summary>
public static class TypeResolverExtension
static class TypeResolverExtension
{
/// <summary>
/// Gets generic interface this type implements.

10
Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs

@ -34,13 +34,9 @@ namespace ICSharpCode.ILSpy.Debugger.Services @@ -34,13 +34,9 @@ namespace ICSharpCode.ILSpy.Debugger.Services
Cancel = 2
}
bool useRemotingForThreadInterop = false;
bool attached;
NDebugger debugger;
ICorPublish corPublish;
Process debuggedProcess;
//DynamicTreeDebuggerRow currentTooltipRow;
@ -512,12 +508,6 @@ namespace ICSharpCode.ILSpy.Debugger.Services @@ -512,12 +508,6 @@ namespace ICSharpCode.ILSpy.Debugger.Services
public void InitializeService()
{
if (useRemotingForThreadInterop) {
// This needs to be called before instance of NDebugger is created
string path = RemotingConfigurationHelpper.GetLoadedAssemblyPath("Debugger.Core.dll");
new RemotingConfigurationHelpper(path).Configure();
}
debugger = new NDebugger();
//debugger.Options = DebuggingOptions.Instance;

4
Debugger/ILSpy.Debugger/Services/ExtensionMethods.cs

@ -19,9 +19,9 @@ using Mono.Cecil; @@ -19,9 +19,9 @@ using Mono.Cecil;
namespace ICSharpCode.ILSpy.Debugger.Services
{
/// <summary>
/// Extension methods used in SharpDevelop.
/// Extension methods used in ILSpy debugger.
/// </summary>
public static class ExtensionMethods
static class ExtensionMethods
{
/// <summary>
/// Raises the event.

8
ILSpy.sln

@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.1.0.7383-alpha
# SharpDevelop 4.1.0.7414-alpha
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debugger", "Debugger", "{1DEB3B4E-03AC-437C-821D-B09FBFCC3E5B}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy.Debugger", "Debugger\ILSpy.Debugger\ILSpy.Debugger.csproj", "{6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Core", "Debugger\Debugger.Core\Debugger.Core.csproj", "{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy.Debugger", "Debugger\ILSpy.Debugger\ILSpy.Debugger.csproj", "{6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy", "ILSpy\ILSpy.csproj", "{1E85EFF9-E370-4683-83E4-8A3D063FF791}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TreeView", "SharpTreeView\ICSharpCode.TreeView.csproj", "{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}"
@ -129,7 +129,7 @@ Global @@ -129,7 +129,7 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {1DEB3B4E-03AC-437C-821D-B09FBFCC3E5B}
{6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A} = {1DEB3B4E-03AC-437C-821D-B09FBFCC3E5B}
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {1DEB3B4E-03AC-437C-821D-B09FBFCC3E5B}
EndGlobalSection
EndGlobal

2
ILSpy/CSharpLanguage.cs

@ -23,7 +23,6 @@ using System.ComponentModel.Composition; @@ -23,7 +23,6 @@ using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Resources;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xaml;
@ -33,7 +32,6 @@ using ICSharpCode.Decompiler; @@ -33,7 +32,6 @@ using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.Ast;
using ICSharpCode.Decompiler.Ast.Transforms;
using ICSharpCode.ILSpy.Baml;
using ICSharpCode.ILSpy.Debugger;
using ICSharpCode.NRefactory.CSharp;
using Mono.Cecil;

3
ILSpy/ILLanguage.cs

@ -18,11 +18,8 @@ @@ -18,11 +18,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.Disassembler;
using ICSharpCode.ILSpy.Debugger;
using Mono.Cecil;
namespace ICSharpCode.ILSpy

6
ILSpy/MainWindow.xaml.cs

@ -32,15 +32,11 @@ using System.Windows.Interop; @@ -32,15 +32,11 @@ using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using ICSharpCode.Decompiler;
using ICSharpCode.ILSpy.Debugger.Services;
using ICSharpCode.ILSpy.TextView;
using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.ILSpy.TreeNodes.Analyzer;
using ICSharpCode.ILSpy.XmlDoc;
using ICSharpCode.TreeView;
using ICSharpCode.ILSpy.Debugger;
using ICSharpCode.ILSpy.Debugger.Services;
using Microsoft.Win32;
using Mono.Cecil;

1
ILSpy/TreeNodes/MethodTreeNode.cs

@ -21,7 +21,6 @@ using System.Text; @@ -21,7 +21,6 @@ using System.Text;
using System.Windows.Media;
using ICSharpCode.Decompiler;
using ICSharpCode.ILSpy.Debugger;
using Mono.Cecil;
namespace ICSharpCode.ILSpy.TreeNodes

1
ILSpy/TreeNodes/PropertyTreeNode.cs

@ -19,7 +19,6 @@ @@ -19,7 +19,6 @@
using System;
using System.Windows.Media;
using ICSharpCode.Decompiler;
using ICSharpCode.ILSpy.Debugger;
using Mono.Cecil;
namespace ICSharpCode.ILSpy.TreeNodes

2
ILSpy/TreeNodes/TypeTreeNode.cs

@ -22,8 +22,6 @@ using System.Linq; @@ -22,8 +22,6 @@ using System.Linq;
using System.Windows.Media;
using ICSharpCode.Decompiler;
using ICSharpCode.ILSpy.Debugger;
using ICSharpCode.ILSpy.Debugger.AvalonEdit;
using Mono.Cecil;
namespace ICSharpCode.ILSpy.TreeNodes

Loading…
Cancel
Save