Documentation ¶
Index ¶
- func AddState(self *SmallFSM, gfsm *GFSM, op Op, chanID ChanID, gid int, sid int)
- func Execute(rt *Runtime, sp *StaticProgram, limit int)
- func LinkState(from *State, to *State, chanID ChanID, op Op)
- type Action
- type ActionStack
- type ActionType
- type BuildHelper
- type ChanID
- type Channel
- type Edge
- type GFSM
- type GID
- type Goroutine
- type IntStack
- type NodeType
- type Op
- type RChannel
- type RGoroutine
- type Runtime
- type SID
- type SIDStack
- type SmallFSM
- type State
- type StaticProgram
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
func Execute(rt *Runtime, sp *StaticProgram, limit int)
Types ¶
type Action ¶
type Action struct { StepID int // 一步可能有多个动作 Score int // 打分值 Onwhich int // 在哪个Goroutine上操作 ToState SID // 到哪个State Onwhich2 int //ACTION_MATCH情况下,RECV的 ToState2 SID //ACTION_MATCH情况下,RECV的 Type ActionType // 哪种动作 ChanID int // SEND/RECV时,用于改变Chan Goroutines []*Goroutine // GO时,用于绑定Goroutine初值 Goroutines2 []*Goroutine // 对于ACTION_MATCH, RECV的GO列表 }
type ActionStack ¶
type ActionStack struct {
// contains filtered or unexported fields
}
func (*ActionStack) Empty ¶
func (s *ActionStack) Empty() bool
func (*ActionStack) Get ¶
func (s *ActionStack) Get(n int) Action
func (*ActionStack) Pop ¶
func (s *ActionStack) Pop()
func (*ActionStack) Push ¶
func (s *ActionStack) Push(i Action)
func (*ActionStack) Size ¶
func (s *ActionStack) Size() int
func (*ActionStack) Top ¶
func (s *ActionStack) Top() Action
type ActionType ¶
type ActionType int
const ( ACTION_MAIN ActionType = iota //初始化Main函数 ACTION_SEND ACTION_RECV ACTION_EPSILON ACTION_MATCH ACTION_ILLEGAL ACTION_SINGLE_SEND ACTION_SINGLE_RECV )
type BuildHelper ¶
type BuildHelper struct { Pack *ssa.Package ChanEnv map[string]int Channels []Channel FuncEnv map[string]int //函数名-下标映射表 walk前添加 Funcs []*ssa.Function //函数列表,walk前添加 GFSMs []*GFSM //自动机列表,walk结束后添加 GoroutineCounter int // 运行时Goroutine序号 //构建过程中暂时使用 CurFuncname string StateCounter int // 自动机的状态计数器,每个自动机从0开始 CurMachine int GlobalStateCounter int // 全局的状态计数器,用于实验统计 }
type Goroutine ¶
type Goroutine struct { Num int // Goroutine序号 Machine GID // 是从哪个函数中spawn出来的 Bindings []ChanID // channel的id,和StaticProgram里的Channels下标一致 }
协程 自动机的Go调用 & Goroutine运行时状态
func AddGoroutine ¶
type RGoroutine ¶
type Runtime ¶
type Runtime struct { Goroutines []RGoroutine Live map[int]int Channels []RChannel Logs ActionStack //日志栈 LogCounter int //当前日志编号 Result int // 抽象执行过程中,产生协程死锁的数量 Paths int // 抽象执行过程中,实际分析的路径数 }
func MakeRuntime ¶
func MakeRuntime(sp *StaticProgram, totalScore int) *Runtime
type State ¶
type State struct { ID SID // GFSM中状态的下标 Gos []*Goroutine // 在这里即将调用的Goroutine,在运行到这里时,会复制 In, Out []*Edge Type NodeType }
协程自动机中的状态
type StaticProgram ¶
type StaticProgram struct { GFSMs []*GFSM //所有协程自动机 Channels []Channel //所有管道,一次运行中,只有一套管道 GoroutineCount int // 运行时可能的总协程数 AllStateCount int // 静态程序的总状态数 }
静态构建的目标,动态运行的初始
func BuildFSMs ¶
func BuildFSMs(fileName string) *StaticProgram
Click to show internal directories.
Click to hide internal directories.