ssaUtils

package
v0.0.0-...-b207433 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLoadPackages = errors.New("loading the following file contained errors")
View Source
var ErrNoPackages = errors.New("no packages in the path")
View Source
var GlobalModuleName string
View Source
var GlobalProgram *ssa.Program

Functions

func AddLock

func AddLock(funcState *domain.BlockState, call *ssa.CallCommon, isUnlock bool)

func Create

func Create(t *testing.T, path, fileName string) *ssa.Package

func EqualDifferentOrder

func EqualDifferentOrder(a, b []*domain.GuardedAccess) bool

func FindGA

func FindGA(GuardedAccesses []*domain.GuardedAccess, validationFunc func(value *domain.GuardedAccess) bool) *domain.GuardedAccess

func FindGAWithFail

func FindGAWithFail(t *testing.T, GuardedAccesses []*domain.GuardedAccess, validationFunc func(value *domain.GuardedAccess) bool) *domain.GuardedAccess

func FindMultipleGA

func FindMultipleGA(GuardedAccesses []*domain.GuardedAccess, validationFunc func(value *domain.GuardedAccess) bool) []*domain.GuardedAccess

func FindMultipleGAWithFail

func FindMultipleGAWithFail(t *testing.T, GuardedAccesses []*domain.GuardedAccess, validationFunc func(value *domain.GuardedAccess) bool, expectedAmount int) []*domain.GuardedAccess

func GetBlockSummary

func GetBlockSummary(context *domain.Context, block *ssa.BasicBlock) *domain.BlockState

func GetConstString

func GetConstString(v *ssa.Const) string

func GetGlobalString

func GetGlobalString(v *ssa.Global) string

func GetMethodImplementations

func GetMethodImplementations(recv types.Type, method *types.Func) []*ssa.Function

func GetStackTrace

func GetStackTrace(prog *ssa.Program, ga *domain.GuardedAccess) string

func HandleBuiltin

func HandleBuiltin(functionState *domain.BlockState, context *domain.Context, call *ssa.CallCommon)

func HandleCallCommon

func HandleCallCommon(context *domain.Context, callCommon *ssa.CallCommon, pos token.Pos) *domain.BlockState

func HandleFunction

func HandleFunction(context *domain.Context, fn *ssa.Function) *domain.BlockState

func HandleInstruction

func HandleInstruction(functionState *domain.BlockState, context *domain.Context, ins ssa.Instruction)

func InitPreProcess

func InitPreProcess(prog *ssa.Program, defaultModulePath string) error

func IsGARead

func IsGARead(ga *domain.GuardedAccess) bool

func IsGAWrite

func IsGAWrite(ga *domain.GuardedAccess) bool

func LoadMain

func LoadMain(t *testing.T, filePath string) (*ssa.Function, *ssa.Package)

func LoadPackage

func LoadPackage(path, modulePath string) (*ssa.Program, *ssa.Package, error)

Types

type CFG

type CFG struct {
	ComputedBlocks      map[int]*domain.BlockState
	ComputedDeferBlocks map[int]*domain.BlockState
	// contains filtered or unexported fields
}

func (*CFG) CalculateFunctionState

func (cfg *CFG) CalculateFunctionState(context *domain.Context, block *ssa.BasicBlock) *domain.BlockState

CalculateFunctionState works by traversing the tree in a DFS way, similar to the flow of the function when it'll run. It calculates the state of the regular flow of block first, then adds the state of any succeeding blocks in the tree, and finally the block's defer state if exist. The function uses two way to aggregate the states between blocks. If the blocks are adjacent (siblings) to each other, (resulted from a branch) then a merge mechanism is used. If one block is below the other, then an append is performed.

type FunctionWithLocksPreprocess

type FunctionWithLocksPreprocess struct {
	FunctionWithLocks map[*types.Signature]bool
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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