Browse Source

Add ShowCFGContextMenuEntry - requires GraphViz dot.exe in PATH.

pull/1440/head
Siegfried Pammer 7 years ago
parent
commit
bec9559385
  1. 4
      ICSharpCode.Decompiler/Properties/AssemblyInfo.template.cs
  2. 35
      ILSpy/Commands/ShowCFGContextMenuEntry.cs
  3. 1
      ILSpy/ILSpy.csproj

4
ICSharpCode.Decompiler/Properties/AssemblyInfo.template.cs

@ -19,6 +19,10 @@ using System.Diagnostics.CodeAnalysis; @@ -19,6 +19,10 @@ using System.Diagnostics.CodeAnalysis;
[assembly: InternalsVisibleTo("ICSharpCode.Decompiler.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001004dcf3979c4e902efa4dd2163a039701ed5822e6f1134d77737296abbb97bf0803083cfb2117b4f5446a217782f5c7c634f9fe1fc60b4c11d62c5b3d33545036706296d31903ddcf750875db38a8ac379512f51620bb948c94d0831125fbc5fe63707cbb93f48c1459c4d1749eb7ac5e681a2f0d6d7c60fa527a3c0b8f92b02bf")]
#if DEBUG
[assembly: InternalsVisibleTo("ILSpy, PublicKey=00240000048000009400000006020000002400005253413100040000010001004dcf3979c4e902efa4dd2163a039701ed5822e6f1134d77737296abbb97bf0803083cfb2117b4f5446a217782f5c7c634f9fe1fc60b4c11d62c5b3d33545036706296d31903ddcf750875db38a8ac379512f51620bb948c94d0831125fbc5fe63707cbb93f48c1459c4d1749eb7ac5e681a2f0d6d7c60fa527a3c0b8f92b02bf")]
#endif
[assembly: SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly",
Justification = "AssemblyInformationalVersion does not need to be a parsable version")]

35
ILSpy/Commands/ShowCFGContextMenuEntry.cs

@ -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
}

1
ILSpy/ILSpy.csproj

@ -109,6 +109,7 @@ @@ -109,6 +109,7 @@
<Compile Include="Commands\OpenListCommand.cs" />
<Compile Include="Commands\Pdb2XmlCommand.cs" />
<Compile Include="Commands\RemoveAssembliesWithLoadErrors.cs" />
<Compile Include="Commands\ShowCFGContextMenuEntry.cs" />
<Compile Include="Commands\ShowDebugSteps.cs" />
<Compile Include="Commands\SortAssemblyListCommand.cs" />
<Compile Include="Controls\BoolToVisibilityConverter.cs" />

Loading…
Cancel
Save