Browse Source

Show tooltip when debugging.

pull/191/merge
Eusebiu Marcu 15 years ago
parent
commit
b46136786e
  1. 22
      Debugger/ILSpy.Debugger/AvalonEdit/IconBarMargin.cs
  2. 1
      Debugger/ILSpy.Debugger/Bookmarks/BookmarkManager.cs
  3. 3
      Debugger/ILSpy.Debugger/Bookmarks/BreakpointBookmark.cs
  4. 2
      Debugger/ILSpy.Debugger/Bookmarks/CurrentLineBookmark.cs
  5. 1
      Debugger/ILSpy.Debugger/ILSpy.Debugger.csproj
  6. 9
      Debugger/ILSpy.Debugger/Services/Debugger/DebuggerService.cs
  7. 16
      Debugger/ILSpy.Debugger/Services/Debugger/IDebugger.cs
  8. 167
      Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs
  9. 6
      Debugger/ILSpy.Debugger/ToolTips/DebuggerTooltipControl.xaml.cs
  10. 5
      Debugger/ILSpy.Debugger/ToolTips/TextEditorListener.cs
  11. 9
      Debugger/ILSpy.Debugger/UI/AttachToProcessWindow.xaml.cs
  12. 4
      ILSpy/MainWindow.xaml
  13. 53
      ILSpy/MainWindow.xaml.cs
  14. 10
      ILSpy/TextView/DecompilerTextView.cs

22
Debugger/ILSpy.Debugger/AvalonEdit/IconBarMargin.cs

@ -40,6 +40,12 @@ namespace ILSpy.Debugger.AvalonEdit
set { currentTypeName = value; } set { currentTypeName = value; }
} }
public IconBarMargin()
{
BookmarkManager.Added += delegate { InvalidateVisual(); };
BookmarkManager.Removed += delegate { InvalidateVisual(); };
}
public virtual void Dispose() public virtual void Dispose()
{ {
this.TextView = null; // detach from TextView (will also detach from manager) this.TextView = null; // detach from TextView (will also detach from manager)
@ -200,6 +206,13 @@ namespace ILSpy.Debugger.AvalonEdit
dragStarted = true; dragStarted = true;
InvalidateVisual(); InvalidateVisual();
} }
BreakpointBookmark bm = BookmarkManager.Bookmarks.Find(
b => b.TypeName == CurrentType.FullName &&
b.LineNumber == GetLineFromMousePosition(e)
&& b is BreakpointBookmark) as BreakpointBookmark;
this.ToolTip = (bm != null) ? bm.Tooltip : null;
} }
protected override void OnMouseUp(MouseButtonEventArgs e) protected override void OnMouseUp(MouseButtonEventArgs e)
@ -215,11 +228,11 @@ namespace ILSpy.Debugger.AvalonEdit
CancelDragDrop(); CancelDragDrop();
} }
if (!e.Handled && line != 0) { if (!e.Handled && line != 0) {
IBookmark bm = GetBookmarkFromLine(line); BookmarkBase bm = GetBookmarkFromLine(line);
if (bm != null) { if (bm != null) {
bm.MouseUp(e); bm.MouseUp(e);
if (CurrentType != null) { if (CurrentType != null) {
DebuggerService.ToggleBreakpointAt(CurrentType.FullName, line); BookmarkManager.RemoveMark(bm);
} }
InvalidateVisual(); InvalidateVisual();
if (e.Handled) if (e.Handled)
@ -228,7 +241,10 @@ namespace ILSpy.Debugger.AvalonEdit
if (e.ChangedButton == MouseButton.Left) { if (e.ChangedButton == MouseButton.Left) {
if (CurrentType != null) { if (CurrentType != null) {
// no bookmark on the line: create a new breakpoint // no bookmark on the line: create a new breakpoint
DebuggerService.ToggleBreakpointAt(CurrentType.FullName, line); DebuggerService.ToggleBreakpointAt(
CurrentType.FullName,
line,
DebuggerService.CurrentDebugger.Language);
} }
} }
InvalidateVisual(); InvalidateVisual();

1
Debugger/ILSpy.Debugger/Bookmarks/BookmarkManager.cs

@ -118,6 +118,7 @@ namespace ILSpy.Debugger.Bookmarks
return; return;
} }
} }
// no bookmark at that line: create a new bookmark // no bookmark at that line: create a new bookmark
BookmarkManager.AddMark(bookmarkFactory(new AstLocation(line, 0))); BookmarkManager.AddMark(bookmarkFactory(new AstLocation(line, 0)));
} }

3
Debugger/ILSpy.Debugger/Bookmarks/BreakpointBookmark.cs

@ -83,9 +83,10 @@ namespace ILSpy.Debugger.Bookmarks
set { tooltip = value; } set { tooltip = value; }
} }
public BreakpointBookmark(string typeName, AstLocation location, BreakpointAction action) : base(typeName, location) public BreakpointBookmark(string typeName, AstLocation location, BreakpointAction action, DecompiledLanguages language) : base(typeName, location)
{ {
this.action = action; this.action = action;
this.tooltip = language.ToString();
} }
public override ImageSource Image { public override ImageSource Image {

2
Debugger/ILSpy.Debugger/Bookmarks/CurrentLineBookmark.cs

@ -27,7 +27,7 @@ namespace ILSpy.Debugger.Bookmarks
endLine = makerEndLine; endLine = makerEndLine;
endColumn = makerEndColumn; endColumn = makerEndColumn;
instance = new CurrentLineBookmark(typeName, new AstLocation(startColumn, startLine)); instance = new CurrentLineBookmark(typeName, new AstLocation(startLine, startColumn));
BookmarkManager.AddMark(instance); BookmarkManager.AddMark(instance);
} }

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

@ -114,6 +114,7 @@
<ItemGroup> <ItemGroup>
<Page Include="ToolTips\DebuggerTooltipControl.xaml" /> <Page Include="ToolTips\DebuggerTooltipControl.xaml" />
<Page Include="ToolTips\PinControlsDictionary.xaml" /> <Page Include="ToolTips\PinControlsDictionary.xaml" />
<Page Include="ToolTips\VisualizerPicker.xaml" />
<Page Include="UI\AttachToProcessWindow.xaml" /> <Page Include="UI\AttachToProcessWindow.xaml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

9
Debugger/ILSpy.Debugger/Services/Debugger/DebuggerService.cs

@ -27,7 +27,7 @@ namespace ILSpy.Debugger.Services
static IDebugger GetCompatibleDebugger() static IDebugger GetCompatibleDebugger()
{ {
return new WindowsDebugger(); return currentDebugger = new WindowsDebugger();
} }
/// <summary> /// <summary>
@ -166,12 +166,12 @@ namespace ILSpy.Debugger.Services
} }
} }
public static void ToggleBreakpointAt(string typeName, int lineNumber) public static void ToggleBreakpointAt(string typeName, int lineNumber, DecompiledLanguages language)
{ {
BookmarkManager.ToggleBookmark( BookmarkManager.ToggleBookmark(
typeName, lineNumber, typeName, lineNumber,
b => b.CanToggle && b is BreakpointBookmark, b => b.CanToggle && b is BreakpointBookmark,
location => new BreakpointBookmark(typeName, location, BreakpointAction.Break)); location => new BreakpointBookmark(typeName, location, BreakpointAction.Break, language));
} }
/* TODO: reimplement this stuff /* TODO: reimplement this stuff
@ -209,9 +209,8 @@ namespace ILSpy.Debugger.Services
string variable = string variable =
ParserService.SimpleParseAt(doc.Text, doc.GetOffset(new TextLocation(logicPos.Line, logicPos.Column))); ParserService.SimpleParseAt(doc.Text, doc.GetOffset(new TextLocation(logicPos.Line, logicPos.Column)));
if (currentDebugger == null || !currentDebugger.IsDebugging) { if (currentDebugger == null || !currentDebugger.IsDebugging || !currentDebugger.CanEvaluate) {
e.ContentToShow = variable; e.ContentToShow = variable;
} }
else { else {

16
Debugger/ILSpy.Debugger/Services/Debugger/IDebugger.cs

@ -9,8 +9,24 @@ using Mono.CSharp;
namespace ILSpy.Debugger.Services namespace ILSpy.Debugger.Services
{ {
public enum DecompiledLanguages
{
IL,
CSharp
}
public interface IDebugger : IDisposable public interface IDebugger : IDisposable
{ {
/// <summary>
/// Gets or sets the decompiled language.
/// </summary>
DecompiledLanguages Language { get; set; }
/// <summary>
/// Gets whether the debugger can evaluate the expression.
/// </summary>
bool CanEvaluate { get; }
/// <summary> /// <summary>
/// Returns true if debuger is attached to a process /// Returns true if debuger is attached to a process
/// </summary> /// </summary>

167
Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs

@ -99,6 +99,8 @@ namespace ILSpy.Debugger.Services
string errorProcessPaused = "Error.ProcessPaused"; string errorProcessPaused = "Error.ProcessPaused";
string errorCannotStepNoActiveFunction = "Threads.CannotStepNoActiveFunction"; string errorCannotStepNoActiveFunction = "Threads.CannotStepNoActiveFunction";
public DecompiledLanguages Language { get; set; }
public bool IsDebugging { public bool IsDebugging {
get { get {
return ServiceInitialized && debuggedProcess != null; return ServiceInitialized && debuggedProcess != null;
@ -372,7 +374,8 @@ namespace ILSpy.Debugger.Services
} }
} }
bool CanEvaluate /// <inheritdoc/>
public bool CanEvaluate
{ {
get { get {
return debuggedProcess != null && !debuggedProcess.IsRunning && debuggedProcess.SelectedStackFrame != null; return debuggedProcess != null && !debuggedProcess.IsRunning && debuggedProcess.SelectedStackFrame != null;
@ -385,7 +388,7 @@ namespace ILSpy.Debugger.Services
/// </summary> /// </summary>
public object GetTooltipControl(AstLocation logicalPosition, string variableName) public object GetTooltipControl(AstLocation logicalPosition, string variableName)
{ {
return new DebuggerTooltipControl(logicalPosition, new ExpressionNode(ImageService.Breakpoint, variableName, null)); return new DebuggerTooltipControl(logicalPosition, new ExpressionNode(null, variableName, null));
//FIXME //FIXME
// try { // try {
// var tooltipExpression = GetExpression(variableName); // var tooltipExpression = GetExpression(variableName);
@ -489,13 +492,29 @@ namespace ILSpy.Debugger.Services
void AddBreakpoint(BreakpointBookmark bookmark) void AddBreakpoint(BreakpointBookmark bookmark)
{ {
uint token; Breakpoint breakpoint = null;
ILCodeMapping map = ILCodeMappings.GetInstructionByTypeAndLine(bookmark.TypeName, bookmark.LineNumber, out token);
switch (Language) {
case DecompiledLanguages.IL:
uint token;
ILCodeMapping map = ILCodeMappings.GetInstructionByTypeAndLine(bookmark.TypeName, bookmark.LineNumber, out token);
if (map != null) {
breakpoint = new ILBreakpoint(debugger, bookmark.LineNumber, token, map.ILInstruction.Offset , bookmark.IsEnabled);
debugger.Breakpoints.Add(breakpoint);
}
break;
case DecompiledLanguages.CSharp:
break;
default:
throw new NotImplementedException("Not implemented!");
}
if (breakpoint == null)
return;
if (map != null) {
Breakpoint breakpoint = new ILBreakpoint(debugger, bookmark.LineNumber, token, map.ILInstruction.Offset , bookmark.IsEnabled);
debugger.Breakpoints.Add(breakpoint);
// Action setBookmarkColor = delegate { // Action setBookmarkColor = delegate {
// if (debugger.Processes.Count == 0) { // if (debugger.Processes.Count == 0) {
// bookmark.IsHealthy = true; // bookmark.IsHealthy = true;
@ -524,65 +543,64 @@ namespace ILSpy.Debugger.Services
// } // }
// } // }
// }; // };
// event handlers on bookmark and breakpoint don't need deregistration // event handlers on bookmark and breakpoint don't need deregistration
bookmark.IsEnabledChanged += delegate { bookmark.IsEnabledChanged += delegate {
breakpoint.Enabled = bookmark.IsEnabled; breakpoint.Enabled = bookmark.IsEnabled;
}; };
breakpoint.Set += delegate { breakpoint.Set += delegate {
//setBookmarkColor();
};
//setBookmarkColor(); //setBookmarkColor();
};
EventHandler<CollectionItemEventArgs<Process>> bp_debugger_ProcessStarted = (sender, e) => {
//setBookmarkColor(); //setBookmarkColor();
// User can change line number by inserting or deleting lines
breakpoint.Line = bookmark.LineNumber; EventHandler<CollectionItemEventArgs<Process>> bp_debugger_ProcessStarted = (sender, e) => {
}; //setBookmarkColor();
EventHandler<CollectionItemEventArgs<Process>> bp_debugger_ProcessExited = (sender, e) => { // User can change line number by inserting or deleting lines
//setBookmarkColor(); breakpoint.Line = bookmark.LineNumber;
}; };
EventHandler<CollectionItemEventArgs<Process>> bp_debugger_ProcessExited = (sender, e) => {
EventHandler<BreakpointEventArgs> bp_debugger_BreakpointHit = //setBookmarkColor();
new EventHandler<BreakpointEventArgs>( };
delegate(object sender, BreakpointEventArgs e)
{ EventHandler<BreakpointEventArgs> bp_debugger_BreakpointHit =
//LoggingService.Debug(bookmark.Action + " " + bookmark.ScriptLanguage + " " + bookmark.Condition); new EventHandler<BreakpointEventArgs>(
delegate(object sender, BreakpointEventArgs e)
switch (bookmark.Action) { {
case BreakpointAction.Break: //LoggingService.Debug(bookmark.Action + " " + bookmark.ScriptLanguage + " " + bookmark.Condition);
break;
case BreakpointAction.Condition: switch (bookmark.Action) {
case BreakpointAction.Break:
break;
case BreakpointAction.Condition:
// if (Evaluate(bookmark.Condition, bookmark.ScriptLanguage)) // if (Evaluate(bookmark.Condition, bookmark.ScriptLanguage))
// DebuggerService.PrintDebugMessage(string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAtBecause}") + "\n", bookmark.LineNumber, bookmark.FileName, bookmark.Condition)); // DebuggerService.PrintDebugMessage(string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAtBecause}") + "\n", bookmark.LineNumber, bookmark.FileName, bookmark.Condition));
// else // else
// this.debuggedProcess.AsyncContinue(); // this.debuggedProcess.AsyncContinue();
break; break;
case BreakpointAction.Trace: case BreakpointAction.Trace:
//DebuggerService.PrintDebugMessage(string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAt}") + "\n", bookmark.LineNumber, bookmark.FileName)); //DebuggerService.PrintDebugMessage(string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAt}") + "\n", bookmark.LineNumber, bookmark.FileName));
break; break;
} }
}); });
BookmarkEventHandler bp_bookmarkManager_Removed = null; BookmarkEventHandler bp_bookmarkManager_Removed = null;
bp_bookmarkManager_Removed = (sender, e) => { bp_bookmarkManager_Removed = (sender, e) => {
if (bookmark == e.Bookmark) { if (bookmark == e.Bookmark) {
debugger.Breakpoints.Remove(breakpoint); debugger.Breakpoints.Remove(breakpoint);
// unregister the events // unregister the events
debugger.Processes.Added -= bp_debugger_ProcessStarted; debugger.Processes.Added -= bp_debugger_ProcessStarted;
debugger.Processes.Removed -= bp_debugger_ProcessExited; debugger.Processes.Removed -= bp_debugger_ProcessExited;
breakpoint.Hit -= bp_debugger_BreakpointHit; breakpoint.Hit -= bp_debugger_BreakpointHit;
BookmarkManager.Removed -= bp_bookmarkManager_Removed; BookmarkManager.Removed -= bp_bookmarkManager_Removed;
} }
}; };
// register the events // register the events
debugger.Processes.Added += bp_debugger_ProcessStarted; debugger.Processes.Added += bp_debugger_ProcessStarted;
debugger.Processes.Removed += bp_debugger_ProcessExited; debugger.Processes.Removed += bp_debugger_ProcessExited;
breakpoint.Hit += bp_debugger_BreakpointHit; breakpoint.Hit += bp_debugger_BreakpointHit;
BookmarkManager.Removed += bp_bookmarkManager_Removed; BookmarkManager.Removed += bp_bookmarkManager_Removed;
}
} }
bool Evaluate(string code, string language) bool Evaluate(string code, string language)
@ -723,13 +741,24 @@ namespace ILSpy.Debugger.Services
DebuggerService.RemoveCurrentLineMarker(); DebuggerService.RemoveCurrentLineMarker();
if (debuggedProcess != null && debuggedProcess.SelectedStackFrame != null) { if (debuggedProcess != null && debuggedProcess.SelectedStackFrame != null) {
uint token = (uint)debuggedProcess.SelectedStackFrame.MethodInfo.MetadataToken; switch (Language) {
int ilOffset = debuggedProcess.SelectedStackFrame.IP; case DecompiledLanguages.IL:
int line; // IL mapping
string typeName; uint token = (uint)debuggedProcess.SelectedStackFrame.MethodInfo.MetadataToken;
ILCodeMappings.GetSourceCodeFromMetadataTokenAndOffset(token, ilOffset, out typeName, out line); int ilOffset = debuggedProcess.SelectedStackFrame.IP;
if (typeName != null) { int line;
DebuggerService.JumpToCurrentLine(typeName, line, 0, line, 0); string typeName;
ILCodeMappings.GetSourceCodeFromMetadataTokenAndOffset(token, ilOffset, out typeName, out line);
if (typeName != null)
DebuggerService.JumpToCurrentLine(typeName, line, 0, line, 0);
break;
case DecompiledLanguages.CSharp:
// FIXME CSharp mappings
break;
default:
throw new NotImplementedException("The language is not supported!");
} }
} }
} }

6
Debugger/ILSpy.Debugger/ToolTips/DebuggerTooltipControl.xaml.cs

@ -30,7 +30,7 @@ namespace ILSpy.Debugger.Tooltips
private const int InitialItemsCount = 12; private const int InitialItemsCount = 12;
private const int VisibleItemsCount = 11; private const int VisibleItemsCount = 11;
private bool showPins = true; private bool showPins;
private LazyItemsControl<ITreeNode> lazyGrid; private LazyItemsControl<ITreeNode> lazyGrid;
private IEnumerable<ITreeNode> itemsSource; private IEnumerable<ITreeNode> itemsSource;
readonly AstLocation logicalPosition; readonly AstLocation logicalPosition;
@ -55,7 +55,7 @@ namespace ILSpy.Debugger.Tooltips
this.itemsSource = nodes; this.itemsSource = nodes;
} }
public DebuggerTooltipControl(DebuggerTooltipControl parentControl, AstLocation logicalPosition, bool showPins = true) public DebuggerTooltipControl(DebuggerTooltipControl parentControl, AstLocation logicalPosition, bool showPins = false)
: this(logicalPosition) : this(logicalPosition)
{ {
this.parentControl = parentControl; this.parentControl = parentControl;
@ -65,7 +65,7 @@ namespace ILSpy.Debugger.Tooltips
private void OnLoaded(object sender, RoutedEventArgs e) private void OnLoaded(object sender, RoutedEventArgs e)
{ {
if (!showPins) { if (!showPins) {
dataGrid.Columns[5].Visibility = Visibility.Collapsed; dataGrid.Columns[4].Visibility = Visibility.Collapsed;
} }
SetItemsSource(this.itemsSource); SetItemsSource(this.itemsSource);

5
Debugger/ILSpy.Debugger/ToolTips/TextEditorListener.cs

@ -67,10 +67,7 @@ namespace ILSpy.Debugger.ToolTips
} }
void OnMouseHoverStopped(MouseEventArgs e) void OnMouseHoverStopped(MouseEventArgs e)
{ {
if (popup != null)
popup.IsOpen = false;
if (toolTip != null) if (toolTip != null)
toolTip.IsOpen = false; toolTip.IsOpen = false;
} }

9
Debugger/ILSpy.Debugger/UI/AttachToProcessWindow.xaml.cs

@ -34,13 +34,6 @@ namespace ILSpy.Debugger.UI
/// </summary> /// </summary>
public partial class AttachToProcessWindow : Window public partial class AttachToProcessWindow : Window
{ {
public static IDebugger Debugger { get; private set; }
static AttachToProcessWindow()
{
Debugger = new WindowsDebugger();
}
public AttachToProcessWindow() public AttachToProcessWindow()
{ {
InitializeComponent(); InitializeComponent();
@ -92,7 +85,7 @@ namespace ILSpy.Debugger.UI
// start attaching // start attaching
var process = ((RunningProcess)this.RunningProcesses.SelectedItem).Process; var process = ((RunningProcess)this.RunningProcesses.SelectedItem).Process;
Debugger.Attach(process); DebuggerService.CurrentDebugger.Attach(process);
this.DialogResult = true; this.DialogResult = true;
} }

4
ILSpy/MainWindow.xaml

@ -156,7 +156,9 @@
<Separator /> <Separator />
<ComboBox Name="languageComboBox" DisplayMemberPath="Name" Width="100" <ComboBox Name="languageComboBox" DisplayMemberPath="Name" Width="100"
ItemsSource="{x:Static local:Languages.AllLanguages}" ItemsSource="{x:Static local:Languages.AllLanguages}"
SelectedItem="{Binding FilterSettings.Language}" /> SelectedItem="{Binding FilterSettings.Language}"
SelectionChanged="LanguageComboBox_SelectionChanged"
/>
<Separator /> <Separator />
<Button x:Name="AttachButton" Command="routedCommands:RoutedUICommands.AttachToProcess" ToolTip="Attach to running process..."> <Button x:Name="AttachButton" Command="routedCommands:RoutedUICommands.AttachToProcess" ToolTip="Attach to running process...">
<Image Width="16" Height="16" Source="Images/bug.png" /> <Image Width="16" Height="16" Source="Images/bug.png" />

53
ILSpy/MainWindow.xaml.cs

@ -27,13 +27,13 @@ using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using ICSharpCode.Decompiler; using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.FlowAnalysis; using ICSharpCode.Decompiler.FlowAnalysis;
using ICSharpCode.ILSpy.TreeNodes; using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.TreeView; using ICSharpCode.TreeView;
using ILSpy.Debugger.AvalonEdit;
using ILSpy.Debugger.Services;
using ILSpy.Debugger.UI; using ILSpy.Debugger.UI;
using Microsoft.Win32; using Microsoft.Win32;
using Mono.Cecil.Rocks; using Mono.Cecil.Rocks;
@ -340,6 +340,17 @@ namespace ICSharpCode.ILSpy
treeView.FocusNode(lastNode); treeView.FocusNode(lastNode);
} }
void OpenFromGac_Click(object sender, RoutedEventArgs e)
{
OpenFromGacDialog dlg = new OpenFromGacDialog();
dlg.Owner = this;
if (dlg.ShowDialog() == true) {
OpenFiles(dlg.SelectedFileNames);
}
}
#endregion
#region Debugger commands #region Debugger commands
void RefreshCommandExecuted(object sender, ExecutedRoutedEventArgs e) void RefreshCommandExecuted(object sender, ExecutedRoutedEventArgs e)
@ -352,7 +363,7 @@ namespace ICSharpCode.ILSpy
void AttachToProcessExecuted(object sender, ExecutedRoutedEventArgs e) void AttachToProcessExecuted(object sender, ExecutedRoutedEventArgs e)
{ {
if (!AttachToProcessWindow.Debugger.IsDebugging) { if (!DebuggerService.CurrentDebugger.IsDebugging) {
var window = new AttachToProcessWindow(); var window = new AttachToProcessWindow();
window.Owner = this; window.Owner = this;
if (window.ShowDialog() == true) if (window.ShowDialog() == true)
@ -369,8 +380,8 @@ namespace ICSharpCode.ILSpy
void DetachFromProcessExecuted(object sender, ExecutedRoutedEventArgs e) void DetachFromProcessExecuted(object sender, ExecutedRoutedEventArgs e)
{ {
if (AttachToProcessWindow.Debugger.IsDebugging){ if (DebuggerService.CurrentDebugger.IsDebugging){
AttachToProcessWindow.Debugger.Detach(); DebuggerService.CurrentDebugger.Detach();
AttachMenuItem.IsEnabled = AttachButton.IsEnabled = true; AttachMenuItem.IsEnabled = AttachButton.IsEnabled = true;
ContinueDebuggingMenuItem.IsEnabled = ContinueDebuggingMenuItem.IsEnabled =
@ -383,26 +394,26 @@ namespace ICSharpCode.ILSpy
void ContinueDebuggingExecuted(object sender, ExecutedRoutedEventArgs e) void ContinueDebuggingExecuted(object sender, ExecutedRoutedEventArgs e)
{ {
if (AttachToProcessWindow.Debugger.IsDebugging) if (DebuggerService.CurrentDebugger.IsDebugging)
AttachToProcessWindow.Debugger.Continue(); DebuggerService.CurrentDebugger.Continue();
} }
void StepIntoExecuted(object sender, ExecutedRoutedEventArgs e) void StepIntoExecuted(object sender, ExecutedRoutedEventArgs e)
{ {
if (AttachToProcessWindow.Debugger.IsDebugging) if (DebuggerService.CurrentDebugger.IsDebugging)
AttachToProcessWindow.Debugger.StepInto(); DebuggerService.CurrentDebugger.StepInto();
} }
void StepOverExecuted(object sender, ExecutedRoutedEventArgs e) void StepOverExecuted(object sender, ExecutedRoutedEventArgs e)
{ {
if (AttachToProcessWindow.Debugger.IsDebugging) if (DebuggerService.CurrentDebugger.IsDebugging)
AttachToProcessWindow.Debugger.StepOver(); DebuggerService.CurrentDebugger.StepOver();
} }
void StepOutExecuted(object sender, ExecutedRoutedEventArgs e) void StepOutExecuted(object sender, ExecutedRoutedEventArgs e)
{ {
if (AttachToProcessWindow.Debugger.IsDebugging) if (DebuggerService.CurrentDebugger.IsDebugging)
AttachToProcessWindow.Debugger.StepOut(); DebuggerService.CurrentDebugger.StepOut();
} }
protected override void OnKeyUp(KeyEventArgs e) protected override void OnKeyUp(KeyEventArgs e)
@ -430,16 +441,6 @@ namespace ICSharpCode.ILSpy
#endregion #endregion
void OpenFromGac_Click(object sender, RoutedEventArgs e)
{
OpenFromGacDialog dlg = new OpenFromGacDialog();
dlg.Owner = this;
if (dlg.ShowDialog() == true) {
OpenFiles(dlg.SelectedFileNames);
}
}
#endregion
#region Exit/About #region Exit/About
void ExitClick(object sender, RoutedEventArgs e) void ExitClick(object sender, RoutedEventArgs e)
{ {
@ -525,5 +526,11 @@ namespace ICSharpCode.ILSpy
sessionSettings.SplitterPosition = leftColumn.Width.Value / (leftColumn.Width.Value + rightColumn.Width.Value); sessionSettings.SplitterPosition = leftColumn.Width.Value / (leftColumn.Width.Value + rightColumn.Width.Value);
sessionSettings.Save(); sessionSettings.Save();
} }
void LanguageComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
DebuggerService.CurrentDebugger.Language =
sessionSettings.FilterSettings.Language.Name == "IL" ? DecompiledLanguages.IL : DecompiledLanguages.CSharp;
}
} }
} }

10
ILSpy/TextView/DecompilerTextView.cs

@ -87,16 +87,8 @@ namespace ICSharpCode.ILSpy.TextView
TextEditorWeakEventManager.MouseHover.AddListener(textEditor, TextEditorListener.Instance); TextEditorWeakEventManager.MouseHover.AddListener(textEditor, TextEditorListener.Instance);
TextEditorWeakEventManager.MouseHoverStopped.AddListener(textEditor, TextEditorListener.Instance); TextEditorWeakEventManager.MouseHoverStopped.AddListener(textEditor, TextEditorListener.Instance);
textEditor.TextArea.TextView.VisualLinesChanged += (s, e) => iconMargin.InvalidateVisual(); textEditor.TextArea.TextView.VisualLinesChanged += (s, e) => iconMargin.InvalidateVisual();
BookmarkManager.Added += BookmarkManager_Added;
BookmarkManager.Removed += (s, e) => iconMargin.InvalidateVisual();
}
void BookmarkManager_Added(object sender, BookmarkEventArgs e)
{
if (e.Bookmark is CurrentLineBookmark) {
iconMargin.InvalidateVisual();
}
} }
#endregion #endregion
#region RunWithCancellation #region RunWithCancellation

Loading…
Cancel
Save