/// <summary> /// Constructs a control flow graph from a collection of instructions, starting at the provided entrypoint address. /// </summary> /// <param name="self">The control flow graph builder to use.</param> /// <param name="entrypoint">The address of the first instruction to traverse.</param> /// <param name="exceptionHandlers">The set of exception handler ranges.</param> /// <returns> /// The constructed control flow graph, with the entrypoint set to the node containing the entrypoint address /// provided in <paramref name="entrypoint"/>. /// </returns> public static ControlFlowGraph <TInstruction> ConstructFlowGraph <TInstruction>( this IFlowGraphBuilder <TInstruction> self, long entrypoint, IEnumerable <ExceptionHandlerRange> exceptionHandlers) { var knownBlockHeaders = new HashSet <long>(); foreach (var range in exceptionHandlers) { knownBlockHeaders.Add(range.ProtectedRange.Start); knownBlockHeaders.Add(range.HandlerRange.Start); } return(self.ConstructFlowGraph(entrypoint, knownBlockHeaders)); }
private IFlowGraph ConstructGraph(IFlowGraphBuilder graphBuilder, Action <ConversionArgs> callback) { var sqrConversion = new SqrConversion(); var sqrtConversion = new SqrtConversion(); var firstConversionLayer = new SequenceLayer(new[] { sqrConversion }); var secondConversionLayer = new SequenceLayer(new[] { sqrConversion }); var thirdConversionLayer = new SequenceLayer(new[] { sqrtConversion }, callback); return(graphBuilder .Add(firstConversionLayer) .AddAndSetAsFinal(secondConversionLayer) .Link(firstConversionLayer, secondConversionLayer) .AddAndSetAsFinal(thirdConversionLayer) .Link(secondConversionLayer, thirdConversionLayer) .Build()); }
/// <summary> /// Constructs a control flow graph, starting at the provided entrypoint address. /// </summary> /// <param name="self">The control flow graph builder to use.</param> /// <param name="entrypoint">The address of the first instruction to traverse.</param> /// <returns> /// The constructed control flow graph, with the entrypoint set to the node containing the entrypoint address /// provided in <paramref name="entrypoint"/>. /// </returns> public static ControlFlowGraph <TInstruction> ConstructFlowGraph <TInstruction>( this IFlowGraphBuilder <TInstruction> self, long entrypoint) { return(self.ConstructFlowGraph(entrypoint, Array.Empty <long>())); }
public FlowServiceProvider(IFlowGraphBuilder graphBuilder) { _graphBuilder = graphBuilder; }
public NumericFlowService(IFlowGraphBuilder graphBuilder, Action <ConversionArgs> callback) { _graph = ConstructGraph(graphBuilder, callback); }