Browse Source

Debug an executable - feature

pull/191/merge
Eusebiu Marcu 15 years ago
parent
commit
ea8bf36298
  1. 3
      Debugger/ILSpy.Debugger/ILSpy.Debugger.csproj
  2. BIN
      Debugger/ILSpy.Debugger/Images/application-x-executable.png
  3. 8
      ILSpy.sln
  4. 4
      ILSpy/Commands/RoutedUICommands.cs
  5. 18
      ILSpy/MainWindow.xaml
  6. 28
      ILSpy/MainWindow.xaml.cs

3
Debugger/ILSpy.Debugger/ILSpy.Debugger.csproj

@ -204,5 +204,8 @@ @@ -204,5 +204,8 @@
<Resource Include="Images\StepOut.png" />
<Resource Include="Images\StepOver.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\application-x-executable.png" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

BIN
Debugger/ILSpy.Debugger/Images/application-x-executable.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

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.7312-alpha
# SharpDevelop 4.1.0.7302-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}"
@ -106,7 +106,7 @@ Global @@ -106,7 +106,7 @@ Global
{6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A}.Release|Any CPU.ActiveCfg = Release|x86
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

4
ILSpy/Commands/RoutedUICommands.cs

@ -33,6 +33,8 @@ namespace ICSharpCode.ILSpy.Commands @@ -33,6 +33,8 @@ namespace ICSharpCode.ILSpy.Commands
StepOut = new RoutedUICommand("Step out", "StepOut", typeof(RoutedUICommands));
RemoveAllBreakpoint = new RoutedUICommand("Remove all breakpoints", "RemoveAllBreakpoint", typeof(RoutedUICommands));
DebugExecutable = new RoutedUICommand("Debug an executable", "DebugExecutable", typeof(RoutedUICommands));
}
public static RoutedUICommand AttachToProcess { get; private set; }
@ -48,5 +50,7 @@ namespace ICSharpCode.ILSpy.Commands @@ -48,5 +50,7 @@ namespace ICSharpCode.ILSpy.Commands
public static RoutedUICommand StepOut { get; private set; }
public static RoutedUICommand RemoveAllBreakpoint { get; private set; }
public static RoutedUICommand DebugExecutable { get; private set; }
}
}

18
ILSpy/MainWindow.xaml

@ -17,6 +17,9 @@ @@ -17,6 +17,9 @@
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</Window.Resources>
<Window.CommandBindings>
<CommandBinding
Command="routedCommands:RoutedUICommands.DebugExecutable"
Executed="DebugExecutableExecuted" />
<CommandBinding
Command="routedCommands:RoutedUICommands.RemoveAllBreakpoint"
Executed="RemoveAllBreakpointExecuted" />
@ -112,7 +115,7 @@ @@ -112,7 +115,7 @@
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="DetachMenuItem" IsEnabled="False"
Header="Detach from running application"
Header="Detach from running application"
Command="routedCommands:RoutedUICommands.DetachFromProcess"/>
<Separator/>
<MenuItem x:Name="RemoveAllBreakpointsItem" Header="Remove all breakpoints" Command="routedCommands:RoutedUICommands.RemoveAllBreakpoint">
@ -120,7 +123,13 @@ @@ -120,7 +123,13 @@
<Image Width="16" Height="16" Source="pack://application:,,,/ILSpy.Debugger;component/Images/DeleteAllBreakpoints.png" />
</MenuItem.Icon>
</MenuItem>
<Separator/>
<MenuItem x:Name="DebugExecutableItem" Header="Debug an executable" Command="routedCommands:RoutedUICommands.DebugExecutable">
<MenuItem.Icon>
<Image Width="16" Height="16" Source="pack://application:,,,/ILSpy.Debugger;component/Images/application-x-executable.png" />
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Header="_Help">
<MenuItem Header="_About" Click="AboutClick" />
@ -163,12 +172,15 @@ @@ -163,12 +172,15 @@
<ComboBox Name="languageComboBox" DisplayMemberPath="Name" Width="100"
ItemsSource="{x:Static local:Languages.AllLanguages}"
SelectedItem="{Binding FilterSettings.Language}"
SelectionChanged="LanguageComboBox_SelectionChanged"
SelectionChanged="LanguageComboBox_SelectionChanged"
/>
<Separator />
<Button x:Name="AttachButton" Command="routedCommands:RoutedUICommands.AttachToProcess" ToolTip="Attach to running process...">
<Image Width="16" Height="16" Source="pack://application:,,,/ILSpy.Debugger;component/Images/bug.png" />
</Button>
<Button x:Name="DebugExecutableButton" Command="routedCommands:RoutedUICommands.DebugExecutable" ToolTip="Debug an executable">
<Image Width="16" Height="16" Source="pack://application:,,,/ILSpy.Debugger;component/Images/application-x-executable.png" />
</Button>
</ToolBar>
<!-- Main grid separating left pane (treeView) from main pane (textEditor) -->
<Grid>

28
ILSpy/MainWindow.xaml.cs

@ -345,11 +345,35 @@ namespace ICSharpCode.ILSpy @@ -345,11 +345,35 @@ namespace ICSharpCode.ILSpy
#region Debugger commands
IDebugger CurrentDebugger {
IDebugger CurrentDebugger {
get {
return DebuggerService.CurrentDebugger;
}
}
void DebugExecutableExecuted(object sender, ExecutedRoutedEventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog() {
Filter = ".NET Executable (*.exe) | *.exe",
RestoreDirectory = true,
DefaultExt = "exe"
};
var result = dialog.ShowDialog();
if (result.HasValue && result.Value) {
string fileName = dialog.FileName;
// add it to references
OpenFiles(new [] { fileName });
if (!CurrentDebugger.IsDebugging) {
// execute the process
CurrentDebugger.Attach(Process.Start(fileName));
EnableDebuggerUI(false);
CurrentDebugger.DebugStopped += OnDebugStopped;
}
}
}
void AttachToProcessExecuted(object sender, ExecutedRoutedEventArgs e)
{
@ -442,6 +466,8 @@ namespace ICSharpCode.ILSpy @@ -442,6 +466,8 @@ namespace ICSharpCode.ILSpy
void EnableDebuggerUI(bool enable)
{
AttachMenuItem.IsEnabled = AttachButton.IsEnabled = enable;
DebugExecutableButton.IsEnabled = DebugExecutableItem.IsEnabled = enable;
ContinueDebuggingMenuItem.IsEnabled =
StepIntoMenuItem.IsEnabled =
StepOverMenuItem.IsEnabled =

Loading…
Cancel
Save