Class MethodPAG

java.lang.Object
qilin.core.pag.MethodPAG

public class MethodPAG extends Object
Part of a pointer assignment graph for a single method.
Author:
Ondrej Lhotak
  • Field Details

    • body

      public Body body
    • nodeFactory

      protected MethodNodeFactory nodeFactory
    • ptaScene

      protected final PTAScene ptaScene
    • config

      protected final PointerAnalysisConfig config
    • stmt2Handlers

      public final Map<Stmt,Map<ClassType,Stmt>> stmt2Handlers
      Every statement of this method that may raise an exception which the pointer analysis tracks (an explicit throw, or a call whose callee may let one escape), mapped to the handlers that are in scope for it: caught exception type -> the handler's first statement. A statement with no enclosing try is still registered, with an empty map - membership in this map is what makes a statement a throw site for Solver.recordThrowStmts, and an uncaught throw still has to reach MethodNodeFactory.caseMethodThrow(). Only filled when PointerAnalysisConfig.isPreciseExceptions() is set; see buildException().
  • Constructor Details

  • Method Details

    • getMethod

      public SootMethod getMethod()
    • nodeFactory

      public MethodNodeFactory nodeFactory()
    • getInvokeStmts

      public Collection<InvokableStmt> getInvokeStmts()
    • addCallStmt

      public boolean addCallStmt(InvokableStmt unit)
    • build

      protected void build()
    • buildNormal

      protected void buildNormal()
    • buildException

      protected void buildException()
      Collects this method's throw sites and the catch handlers in scope for each of them into stmt2Handlers, from which Solver.recordThrowStmts() creates the throw sites and ExceptionHandler.dispatch() routes each thrown object to a handler.

      We use the same logic as doop (library/exceptions/precise.logic): only explicit throws and exceptions propagated out of callees are modelled, never implicit ones (NPE, ArrayIndexOutOfBounds, ...).

      Unlike Soot, SootUp has no ordered exception table to read back: traps are stored in the block graph as ControlFlowGraph.exceptionalSuccessors(Stmt), an unordered map keyed by caught type. Handler priority is therefore re-derived at dispatch time by preferring the most specific matching type, which reproduces the bytecode order for handlers of one try (Java rejects catching a subtype after its supertype there).

    • addMiscEdges

      protected void addMiscEdges()
    • addInternalEdge

      public void addInternalEdge(PagNode src, PagNode dst)
    • getInternalReader

      public QueueReader<PagNode> getInternalReader()
    • addTriggeredClinit

      public void addTriggeredClinit(SootMethod clinit)
    • triggeredClinits

      public Iterator<SootMethod> triggeredClinits()
    • addExceptionEdge

      public void addExceptionEdge(PagNode from, PagNode to)
    • getExceptionEdges

      public Map<PagNode,Set<PagNode>> getExceptionEdges()