Class CFGVerifier<InsnType extends IInstruction>

java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.cfg.CFGVerifier<InsnType>
Type Parameters:
InsnType -

public class CFGVerifier<InsnType extends IInstruction> extends Object
Verifier of control flow graphs. Verification is expensive: this class should be reserved for test cases or debug-mode.
  • Field Details

  • Constructor Details

  • Method Details

    • customVerification

      protected void customVerification() throws CfgVerificationException
      Custom validation method that may be overridden by subclasses which wish to validate the CFG further. This method is called by verify() as a first validation step. The default implementation does nothing (return true).
      Throws:
      CfgVerificationException - thrown if the CFG is deemed invalid
    • shouldExpectFallthrough

      protected boolean shouldExpectFallthrough(InsnType insn)
      Parameters:
      insn -
      Returns:
    • verify

      public void verify() throws CfgVerificationException
      A CFG is considered valid if:

      • there is only one (or none) branching instruction per basic block, located at its end (taking into account the possible delay-slot)
      • the branching instructions are synchronized with the edges, i.e. they both represent the same information in the same order (fallthrough first)
      • there is no duplicate edges

      Note: duplicate edges can happen at native level due to JCC-to-fallthrough.

      Throws:
      CfgVerificationException - thrown if the CFG verification failed