public class

CFGUtil

extends Object
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.units.code.CFGUtil

Class Overview

Utility for IControlFlowGraph.

Summary

Public Constructors
CFGUtil()
Public Methods
static void toDot(IControlFlowGraph<?> cfg, File file)
Build the CFG text representation using the dot language.
static void toDot(IControlFlowGraph<?> cfg, File file, String title, Map<Long, String> blockHeaders, int lineLimit)
Build the CFG text representation using the dot language.
static void toDot(IControlFlowGraph<?> cfg, File file, String title, Map<Long, String> blockHeaders)
Build the CFG text representation using the dot language.
static void toDot(IControlFlowGraph<?> cfg, File file, String title)
Build the CFG text representation using the dot language.
static void toTempDot(IControlFlowGraph<?> cfg, String name)
static void toTempDot(IControlFlowGraph<?> cfg, String name, String title, Map<Long, String> blockHeaders, int lineLimit)
static void verify(IControlFlowGraph<?> cfg)
Verification of a CFG.
static void verify(IControlFlowGraph<?> cfg, boolean checkConnected, boolean checkGapless, boolean checkFlowinfo, boolean checkNoDupEdges, boolean checkNoDupIrregularEdges)
Verification of a CFG.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public CFGUtil ()

Public Methods

public static void toDot (IControlFlowGraph<?> cfg, File file)

Build the CFG text representation using the dot language. To generate a PNG: dot out.dot -Tpng -o out.png

Parameters
file output file
Throws
IOException

public static void toDot (IControlFlowGraph<?> cfg, File file, String title, Map<Long, String> blockHeaders, int lineLimit)

Build the CFG text representation using the dot language. To generate a PNG: dot out.dot -Tpng -o out.png

Throws
IOException

public static void toDot (IControlFlowGraph<?> cfg, File file, String title, Map<Long, String> blockHeaders)

Build the CFG text representation using the dot language. To generate a PNG: dot out.dot -Tpng -o out.png

Parameters
file output file
title optional graph title
blockHeaders optional map of block headers (block_address -> block_description_string); if null, a standard header "(block_index)" is used
Throws
IOException

public static void toDot (IControlFlowGraph<?> cfg, File file, String title)

Build the CFG text representation using the dot language. To generate a PNG: dot out.dot -Tpng -o out.png

Parameters
file output file
title optional graph title
Throws
IOException

public static void toTempDot (IControlFlowGraph<?> cfg, String name)

public static void toTempDot (IControlFlowGraph<?> cfg, String name, String title, Map<Long, String> blockHeaders, int lineLimit)

public static void verify (IControlFlowGraph<?> cfg)

Verification of a CFG. Throws RuntimeException (or derived) on error.

Calls verify(IControlFlowGraph, boolean, boolean, boolean, boolean, boolean) with all optional checks enabled.

Parameters
cfg the CFG to be verified
Throws
RuntimeException if the verification failed

public static void verify (IControlFlowGraph<?> cfg, boolean checkConnected, boolean checkGapless, boolean checkFlowinfo, boolean checkNoDupEdges, boolean checkNoDupIrregularEdges)

Verification of a CFG. Throws RuntimeException (or derived) on error.

This method checks the following:
- the graph is not empty
- no block is empty
- all blocks are reachable, either regularly or irregularly, from the entry node #0

Additional optional checks can be performed, see the parameters.

Parameters
cfg the CFG to be verified
checkConnected if true, the graph is verified to be connected, i.e. all blocks must be reachable from the entry block
checkGapless if true, the graph cannot have gaps between basic blocks
checkFlowinfo if true, consistency checks between getBreakingFlow(long) and getOutputBlocks() are performed
checkNoDupEdges if true, verify that CFG input/output regular edges of basic blocks do not contain duplicates
checkNoDupIrregularEdges if true, verify that CFG input/output irregular edges of basic blocks do not contain duplicates
Throws
RuntimeException if the verification failed