path

package
v0.0.0-...-3f344d0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2021 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFindNone = fmt.Errorf("Found none")
View Source
var ErrInaccurateCallgraph = fmt.Errorf("The callgraph is inaccurate: a caller has multiple callees or a callee has multiple callers")
View Source
var ErrNilNode = fmt.Errorf("Nil node in callgraph")
View Source
var ErrNotComplete = fmt.Errorf("Incomplete callchains")
View Source
var LcaErrNilNode = fmt.Errorf("Node in callgraph for target function is nil")
View Source
var LcaErrReachedMax = fmt.Errorf("Reached max layer number")

Functions

func CopyEdgeSlice

func CopyEdgeSlice(old []*callgraph.Edge) []*callgraph.Edge

func CopyNodeSlice

func CopyNodeSlice(old []*callgraph.Node) []*callgraph.Node

func DFSPathLocalBB

func DFSPathLocalBB(bbCur, bbTarget *ssa.BasicBlock, path []*ssa.BasicBlock) (result []*ssa.BasicBlock)

func EnumeratePathForPostDomBBs

func EnumeratePathForPostDomBBs(bb1, bb2 *ssa.BasicBlock) [][]*ssa.BasicBlock

Enumerate all paths between bb1 and bb2. Requires that bb2 post-dominates bb1

func FindLCA

func FindLCA(vecTargetFn []*ssa.Function, boolGiveUpWhenCallgraphIsInaccurate bool, boolGiveUpWhenMaxLayerIsReached bool, intMaxLayer int) (map[*ssa.Function][]*EdgeChain, error)

Find the lowest common ancestors for target functions. This function is used by two places: computing dependency and checking each channel. The configurations should be different Note 1: we can't use some classic algorithms because in callgraph one child may have multiple parents, and there may be circles in the callgraph Note 2: result is a map from one LCA to the targets it covers. It is possible that we can't find one LCA that covers every target Note 3: intMaxLayer is used if boolGiveUpWhenMaxLayerIsReached is false

func FindSelectNexts

func FindSelectNexts(s *ssa.Select) (map[int]ssa.Instruction, error)

Every Select is only used in Extract. Among all Extract, only one Extract's Index is 0 (0 means obtaining the case index) This Extract will be used by N BinOp(where OP is ==), N is the number of cases (default is not counted) If the case is not empty, the next inst will be If; if the case is empty, the next inst can be anything If Select has case 0,1,2,(default), then BinOp.Y will be 0,1,2. Find the BinOp.Y == 2. If the next inst is If, default is If.Else. If the next is not If, meaning default and the last case are going to the same place

func PathBetweenInst

func PathBetweenInst(inst1, inst2 ssa.Instruction) (result []*ssa.BasicBlock)

func PathBetweenLocalInst

func PathBetweenLocalInst(inst1, inst2 ssa.Instruction) (result []*ssa.BasicBlock)

Types

type EdgeChain

type EdgeChain struct {
	Chain []*callgraph.Edge
	Start *callgraph.Node
}

func (*EdgeChain) Contains

func (e *EdgeChain) Contains(q *EdgeChain) bool

If e.Chain is ABC, q.Chain is A or AB or ABC, return true

func (*EdgeChain) Equal

func (e *EdgeChain) Equal(q *EdgeChain) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL