mirror of https://github.com/icsharpcode/ILSpy.git
3 changed files with 40 additions and 0 deletions
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
using System; |
||||
using System.Windows; |
||||
using ICSharpCode.Decompiler.FlowAnalysis; |
||||
using ICSharpCode.Decompiler.IL; |
||||
using ICSharpCode.Decompiler.IL.ControlFlow; |
||||
|
||||
namespace ICSharpCode.ILSpy.Commands |
||||
{ |
||||
#if DEBUG
|
||||
[ExportContextMenuEntry(Header = "DEBUG -- Show CFG")] |
||||
internal class ShowCFGContextMenuEntry : IContextMenuEntry |
||||
{ |
||||
public void Execute(TextViewContext context) |
||||
{ |
||||
try { |
||||
var container = (BlockContainer)context.Reference.Reference; |
||||
var cfg = new ControlFlowGraph(container); |
||||
ControlFlowNode.ExportGraph(cfg.cfg).Show(); |
||||
} catch (Exception ex) { |
||||
MessageBox.Show("Error generating CFG - requires GraphViz dot.exe in PATH" + Environment.NewLine + Environment.NewLine + ex.ToString()); |
||||
} |
||||
} |
||||
|
||||
public bool IsEnabled(TextViewContext context) |
||||
{ |
||||
return context.Reference?.Reference is BlockContainer; |
||||
} |
||||
|
||||
public bool IsVisible(TextViewContext context) |
||||
{ |
||||
return context.Reference?.Reference is BlockContainer; |
||||
} |
||||
} |
||||
#endif
|
||||
} |
Loading…
Reference in new issue