Documentation
¶
Index ¶
- func AllPackages(funcs map[*ssa.Function]bool) []*ssa.Package
- func NewState(c *config.State) result.Result[State]
- func PrintErrors(logger *config.LogGroup, pkgs []*packages.Package) int
- type GoModInfo
- type State
- func (wps *State) FindMain() (*ssa.Function, error)
- func (wps *State) IncrementAndTestAlarms() bool
- func (wps *State) ReachableFunctions() (map[*ssa.Function]bool, error)
- func (wps *State) ResetAlarms()
- func (wps *State) ResolveCallee(instr ssa.CallInstruction) (map[*ssa.Function]lang.CalleeInfo, error)
- func (wps *State) TestAlarmCount() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllPackages ¶
AllPackages returns the slice of all packages the set of functions provided as argument belong to.
Types ¶
type State ¶
type State struct {
config.State
// GoModInfo is the path to the go.mod file
GoModInfo GoModInfo
// 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 ¶
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 ¶
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 ¶
TestAlarmCount tests whether the alarm count is smaller than the maximum number of alarms allowed by the configuration.