Skip to content

Commit

Permalink
Include exception handlers in CIL CFG (see #42)
Browse files Browse the repository at this point in the history
  • Loading branch information
holly-hacker committed Oct 19, 2020
1 parent 40c53e7 commit 929243e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dnSpy.Extension.HoLLy/ControlFlowGraph/GraphProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Text;
using System.Windows.Media;
using dnlib.DotNet;
Expand Down Expand Up @@ -31,12 +32,13 @@ public static GraphProvider Create(MethodDef method)
var methodName = IdentifierEscaper.Escape(method.Name);
switch (method.MethodBody)
{
case CilBody _:
case CilBody cilBody:
{
var arch = new CilArchitecture(method);
var stateResolver = new CilStateTransitionResolver(arch);
var cflowBuilder = new SymbolicFlowGraphBuilder<Instruction>(arch, method.Body.Instructions, stateResolver);
var cflow = cflowBuilder.ConstructFlowGraph(0);
var handlers = cilBody.ExceptionHandlers.Select(DnlibExtensions.ToEchoRange);
var cflow = cflowBuilder.ConstructFlowGraph(0, handlers);
return new ControlFlowGraphProvider<Instruction>(methodName, cflow);
}
case NativeMethodBody _:
Expand Down

0 comments on commit 929243e

Please sign in to comment.