loadprogram

package
v0.3.5-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllPackages

func AllPackages(funcs map[*ssa.Function]bool) []*ssa.Package

AllPackages returns the slice of all packages the set of functions provided as argument belong to.

func NewState

func NewState(c *config.State) result.Result[State]

NewState construct a whole program state from the provided SSA program and packages, and the config with its logger. The packages are visited to extract all the annotations in the program.

Types

type State

type State struct {
	config.State

	// Annotations contains all the annotations of the program
	Annotations annotations.ProgramAnnotations

	// Packages store the packages initially loaded. Can be used to seek syntactic information
	Packages []*packages.Package

	// The program to be analyzed. It should be a complete buildable program (e.g. loaded by LoadProgram).
	Program *ssa.Program

	// Report contains the accumulated report information
	Report *config.ReportInfo
	// contains filtered or unexported fields
}

A State is the base state for the analyses in Argot. Analyses that do not require whole-program analysis should be built with the go tools analysis framework (https://pkg.go.dev/golang.org/x/tools/go/analysis)

func (*State) IncrementAndTestAlarms

func (wps *State) IncrementAndTestAlarms() bool

IncrementAndTestAlarms increments the alarm counter in the state, and returns false if the count is larger than the MaxAlarms setting in the config.

func (*State) ReachableFunctions

func (wps *State) ReachableFunctions() (map[*ssa.Function]bool, error)

ReachableFunctions returns the set of reachable functions from main and init according to the CHA analysis.

func (*State) ResetAlarms

func (wps *State) ResetAlarms()

ResetAlarms resets the number of alarms to 0

func (*State) ResolveCallee

func (wps *State) ResolveCallee(instr ssa.CallInstruction) (map[*ssa.Function]lang.CalleeInfo, error)

ResolveCallee resolves the callee(s) at the call instruction instr. It resolves callees by first looking into static callees, and then the CHA callgraph if no static callee is found.

func (*State) TestAlarmCount

func (wps *State) TestAlarmCount() bool

TestAlarmCount tests whether the alarm count is smaller than the maximum number of alarms allowed by the configuration.

Jump to

Keyboard shortcuts

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