public class

CFGVerifier

extends Object
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.units.code.asm.cfg.CFGVerifier<InsnType extends com.pnfsoftware.jeb.core.units.code.IInstruction>

Class Overview

Verifier of control flow graphs. Verification is expensive: this class should be reserved for test cases or debug-mode.

Summary

Fields
protected CFG<InsnType extends IInstruction> cfg
Public Constructors
CFGVerifier(CFG<InsnType> cfg)
Public Methods
void verify()
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.
Protected Methods
void customVerification()
Custom validation method that may be overridden by subclasses which wish to validate the CFG further.
boolean shouldExpectFallthrough(InsnType insn)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected CFG<InsnType extends IInstruction> cfg

Public Constructors

public CFGVerifier (CFG<InsnType> cfg)

Public Methods

public void verify ()

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

Protected Methods

protected void customVerification ()

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

protected boolean shouldExpectFallthrough (InsnType insn)