Documentation ¶
Index ¶
- Variables
- func GetBareNode(v *Value) ssa.InstructionNode
- func GetBareType(typ *Type) ssa.Type
- func TypeCompare(t1, t2 *Type) bool
- func ValueCompare(v1, v2 *Value) bool
- type AnalyzeContext
- func (g *AnalyzeContext) GetCurrentCall() *Value
- func (a *AnalyzeContext) IsExistedInCallStack(i *Value) bool
- func (a *AnalyzeContext) PopCall() *Value
- func (a *AnalyzeContext) PushCall(i *Value) error
- func (a *AnalyzeContext) TheCallShouldBeVisited(i *Value) bool
- func (a *AnalyzeContext) ThePhiShouldBeVisited(i *Value) bool
- func (a *AnalyzeContext) VisitPhi(i *Value)
- type DominatorForest
- type DominatorTree
- type Language
- type LanguageParser
- type OperationConfig
- type OperationOption
- type Option
- func WithDefineFunc(table map[string]any) Option
- func WithExternInfo(info string) Option
- func WithExternLib(name string, table map[string]any) Option
- func WithExternMethod(b ssa.MethodBuilder) Option
- func WithExternValue(table map[string]any) Option
- func WithFeedCode(b ...bool) Option
- func WithIgnoreSyntaxError(b ...bool) Option
- func WithLanguage(language Language) Option
- type Program
- func (p *Program) AddConfig(c *config)
- func (p *Program) Feed(code string)
- func (p *Program) GetAllSymbols() map[string]Values
- func (p *Program) GetErrors() ssa.SSAErrors
- func (p *Program) GetInstructionById(id int) ssa.Instruction
- func (p *Program) GetValueById(id int) (*Value, error)
- func (p *Program) GetValueByIdMust(id int) *Value
- func (p *Program) IsNil() bool
- func (p *Program) Ref(name string) Values
- func (p *Program) Show() *Program
- type Type
- type Value
- func (v *Value) AnalyzeDepth() int
- func (v *Value) AppendDependOn(i *Value) *Value
- func (v *Value) AppendEffectOn(i *Value) *Value
- func (v *Value) Backtrack() *omap.OrderedMap[string, *Value]
- func (v *Value) Compare(other *Value) bool
- func (v *Value) Dot() string
- func (v *Value) FixUpdateValue() Values
- func (v *Value) FlexibleDepends() *Value
- func (v *Value) GetBlock() *Value
- func (v *Value) GetBottomUses() Values
- func (v *Value) GetCallArgs() Values
- func (v *Value) GetCallReturns() Values
- func (v *Value) GetCalledBy() Values
- func (v *Value) GetCallee() *Value
- func (v *Value) GetConst() *ssa.Const
- func (v *Value) GetConstValue() any
- func (v *Value) GetContextValue(i string) (*Value, bool)
- func (i *Value) GetDefs() Values
- func (v *Value) GetDepth() int
- func (i *Value) GetFieldName() *Value
- func (i *Value) GetFieldValues() Values
- func (i *Value) GetFirstFieldValue() *Value
- func (v *Value) GetFunction() *Value
- func (v *Value) GetId() int
- func (i *Value) GetLatestFieldValue() *Value
- func (v *Value) GetMakeObjectFields() Values
- func (i *Value) GetName() string
- func (v *Value) GetOpcode() ssa.Opcode
- func (i *Value) GetOperand(index int) *Value
- func (i *Value) GetOperands() Values
- func (v *Value) GetParameter(i int) *Value
- func (v *Value) GetParameters() Values
- func (v *Value) GetRange() *ssa.Range
- func (v *Value) GetReachable() *Value
- func (v *Value) GetReturn() Values
- func (v *Value) GetSelf() *Value
- func (i *Value) GetTopDefs(opt ...OperationOption) Values
- func (v *Value) GetType() *Type
- func (v *Value) GetTypeKind() ssa.TypeKind
- func (i *Value) GetUser(index int) *Value
- func (i *Value) GetUsers() Values
- func (i *Value) GetVerboseName() string
- func (i *Value) HasOperands() bool
- func (i *Value) HasUsers() bool
- func (v *Value) InMainFunction() bool
- func (v *Value) IsAssert() bool
- func (v *Value) IsBasicBlock() bool
- func (v *Value) IsBinOp() bool
- func (v *Value) IsCall() bool
- func (v *Value) IsCalled() bool
- func (v *Value) IsConstInst() bool
- func (v *Value) IsErrorHandler() bool
- func (v *Value) IsExternLib() bool
- func (v *Value) IsField() bool
- func (v *Value) IsFunction() bool
- func (v *Value) IsIf() bool
- func (v *Value) IsJump() bool
- func (v *Value) IsLoop() bool
- func (v *Value) IsMake() bool
- func (v *Value) IsModifySelf() bool
- func (v *Value) IsNext() bool
- func (v *Value) IsPanic() bool
- func (v *Value) IsParameter() bool
- func (v *Value) IsPhi() bool
- func (v *Value) IsReachable() int
- func (v *Value) IsRecover() bool
- func (v *Value) IsReturn() bool
- func (v *Value) IsSwitch() bool
- func (v *Value) IsTypeCast() bool
- func (v *Value) IsTypeValue() bool
- func (v *Value) IsUnOp() bool
- func (v *Value) IsUndefined() bool
- func (v *Value) IsUpdate() bool
- func (v *Value) LoadFullUseDefChain() *Value
- func (v *Value) NewError(tag, msg string)
- func (v *Value) NewWarn(tag, msg string)
- func (v *Value) RecursiveDepends(h func(value *Value) error)
- func (v *Value) RecursiveDependsAndEffects(h func(value *Value) error)
- func (v *Value) RecursiveEffects(h func(value *Value) error)
- func (v *Value) SetContextValue(i string, values *Value) *Value
- func (v *Value) SetDepth(i int)
- func (v *Value) ShortString() string
- func (i *Value) Show()
- func (v *Value) ShowBacktrack()
- func (v *Value) ShowDot() *Value
- func (v *Value) ShowUseDefChain()
- func (i *Value) ShowWithSource()
- func (v *Value) String() string
- func (i *Value) StringWithSource() string
- type Values
- func (i Values) AppendDependOn(v *Value) Values
- func (i Values) AppendEffectOn(v *Value) Values
- func (v Values) Filter(f func(*Value) bool) Values
- func (v Values) Flat(f func(*Value) Values) Values
- func (v Values) FlexibleDepends() Values
- func (v Values) ForEach(f func(*Value)) Values
- func (v Values) FullUseDefChain(h func(*Value))
- func (v Values) Get(i int) *Value
- func (v Values) GetBottomUses() Values
- func (v Values) GetDefs() Values
- func (v Values) GetTopDefs(opts ...OperationOption) Values
- func (v Values) GetUsers() Values
- func (value Values) Ref(name string) Values
- func (v Values) Show(b ...bool) Values
- func (V Values) ShowDot() Values
- func (v Values) ShowWithSource(b ...bool) Values
- func (v Values) String() string
- func (v Values) StringEx(flag int) string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Number = NewType(ssa.BasicTypes[ssa.Number]) String = NewType(ssa.BasicTypes[ssa.String]) Bytes = NewType(ssa.BasicTypes[ssa.Bytes]) Boolean = NewType(ssa.BasicTypes[ssa.Boolean]) UndefinedType = NewType(ssa.BasicTypes[ssa.UndefinedType]) Null = NewType(ssa.BasicTypes[ssa.Null]) Any = NewType(ssa.BasicTypes[ssa.Any]) ErrorType = NewType(ssa.BasicTypes[ssa.ErrorType]) )
View Source
var (
ANALYZE_RUNTIME_CTX_TOPDEF_CALL_ENTRY = "call_entry"
)
View Source
var Exports = map[string]any{ "Parse": Parse, "withLanguage": WithLanguage, "withExternLib": WithExternLib, "withExternValue": WithExternValue, "Javascript": JS, "Yak": Yak, }
View Source
var LanguageParsers = map[Language]LanguageParser{ Yak: yak2ssa.NewParser(), JS: js2ssa.NewParser(), }
Functions ¶
func GetBareNode ¶ added in v1.2.9
func GetBareNode(v *Value) ssa.InstructionNode
func GetBareType ¶ added in v1.2.9
func TypeCompare ¶ added in v1.2.9
func ValueCompare ¶ added in v1.2.9
Types ¶
type AnalyzeContext ¶ added in v1.3.0
type AnalyzeContext struct {
// contains filtered or unexported fields
}
func NewAnalyzeContext ¶ added in v1.3.0
func NewAnalyzeContext(opt ...OperationOption) *AnalyzeContext
func (*AnalyzeContext) GetCurrentCall ¶ added in v1.3.0
func (g *AnalyzeContext) GetCurrentCall() *Value
func (*AnalyzeContext) IsExistedInCallStack ¶ added in v1.3.0
func (a *AnalyzeContext) IsExistedInCallStack(i *Value) bool
func (*AnalyzeContext) PopCall ¶ added in v1.3.0
func (a *AnalyzeContext) PopCall() *Value
func (*AnalyzeContext) PushCall ¶ added in v1.3.0
func (a *AnalyzeContext) PushCall(i *Value) error
func (*AnalyzeContext) TheCallShouldBeVisited ¶ added in v1.3.0
func (a *AnalyzeContext) TheCallShouldBeVisited(i *Value) bool
func (*AnalyzeContext) ThePhiShouldBeVisited ¶ added in v1.3.0
func (a *AnalyzeContext) ThePhiShouldBeVisited(i *Value) bool
ThePhiShouldBeVisited is used to check whether the phi should be visited
func (*AnalyzeContext) VisitPhi ¶ added in v1.3.0
func (a *AnalyzeContext) VisitPhi(i *Value)
type DominatorForest ¶ added in v1.3.1
type DominatorForest struct {
Trees []*DominatorTree
}
type DominatorTree ¶ added in v1.3.1
type DominatorTree *omap.OrderedMap[int, *Value]
type LanguageParser ¶ added in v1.3.0
type OperationConfig ¶ added in v1.3.1
type OperationConfig struct { // 限制递归深度,每一次递归核心函数,计数器都会加一 // 上下文计数器受到这个限制 MaxDepth int MinDepth int // Hook HookEveryNode func(*Value) error }
func NewOperations ¶ added in v1.3.1
func NewOperations(opt ...OperationOption) *OperationConfig
type OperationOption ¶ added in v1.3.1
type OperationOption func(*OperationConfig)
func WithDepthLimit ¶ added in v1.3.1
func WithDepthLimit(depth int) OperationOption
func WithHookEveryNode ¶ added in v1.3.1
func WithHookEveryNode(hookNode func(*Value) error) OperationOption
func WithMaxDepth ¶ added in v1.3.1
func WithMaxDepth(maxDepth int) OperationOption
func WithMinDepth ¶ added in v1.3.1
func WithMinDepth(minDepth int) OperationOption
type Option ¶
type Option func(*config)
func WithDefineFunc ¶ added in v1.3.1
func WithExternInfo ¶ added in v1.3.0
func WithExternMethod ¶ added in v1.2.9
func WithExternMethod(b ssa.MethodBuilder) Option
func WithExternValue ¶
func WithFeedCode ¶ added in v1.3.1
func WithIgnoreSyntaxError ¶ added in v1.3.0
func WithLanguage ¶
type Program ¶
func NewProgram ¶
func (*Program) GetAllSymbols ¶ added in v1.3.0
func (*Program) GetInstructionById ¶ added in v1.3.0
func (p *Program) GetInstructionById(id int) ssa.Instruction
func (*Program) GetValueById ¶ added in v1.3.0
func (*Program) GetValueByIdMust ¶ added in v1.3.0
type Value ¶
func FullUseDefChain ¶ added in v1.3.1
func FullUseDefChain(value *Value, opts ...OperationOption) *Value
func NewValue ¶
func NewValue(n ssa.InstructionNode) *Value
func (*Value) AnalyzeDepth ¶ added in v1.3.1
func (*Value) AppendDependOn ¶ added in v1.3.1
func (*Value) AppendEffectOn ¶ added in v1.3.1
func (*Value) Backtrack ¶ added in v1.3.1
func (v *Value) Backtrack() *omap.OrderedMap[string, *Value]
func (*Value) FixUpdateValue ¶ added in v1.2.9
func (*Value) FlexibleDepends ¶ added in v1.3.1
FlexibleDepends is used to get all the dependencies of the value e.g: a = b + c; d = a + e; the e is not filled in the depends of a, but call FlexibleDepends will get it
func (*Value) GetBottomUses ¶ added in v1.3.0
func (*Value) GetCallArgs ¶ added in v1.3.0
func (*Value) GetCallReturns ¶ added in v1.3.0
func (*Value) GetCalledBy ¶ added in v1.3.0
GetCalledBy desc all of 'Users' is Call or Make
func (*Value) GetConstValue ¶ added in v1.2.9
for const instruction
func (*Value) GetContextValue ¶ added in v1.3.0
GetContextValue can handle context
func (*Value) GetFieldName ¶ added in v1.3.0
func (*Value) GetFieldValues ¶ added in v1.3.0
func (*Value) GetFirstFieldValue ¶ added in v1.3.0
func (*Value) GetFunction ¶
func (*Value) GetLatestFieldValue ¶ added in v1.3.0
func (*Value) GetMakeObjectFields ¶ added in v1.3.0
func (*Value) GetOperand ¶
func (*Value) GetOperands ¶
func (*Value) GetParameter ¶
func (*Value) GetParameters ¶ added in v1.2.9
func (*Value) GetReachable ¶
func (*Value) GetTopDefs ¶ added in v1.3.0
func (i *Value) GetTopDefs(opt ...OperationOption) Values
GetTopDefs desc all of 'Defs' is not used by any other value
func (*Value) GetTypeKind ¶ added in v1.2.9
func (*Value) GetVerboseName ¶ added in v1.3.1
func (*Value) HasOperands ¶
func (*Value) InMainFunction ¶
func (*Value) IsBasicBlock ¶
func (*Value) IsConstInst ¶
func (*Value) IsErrorHandler ¶
func (*Value) IsExternLib ¶ added in v1.3.1
func (*Value) IsFunction ¶
func (*Value) IsModifySelf ¶ added in v1.2.9
func (*Value) IsParameter ¶ added in v1.2.9
func (*Value) IsReachable ¶
if condition is true : 1 reach if condition is false : -1 unreachable if condition need calc: 0 unknown
func (*Value) IsTypeCast ¶
func (*Value) IsTypeValue ¶
func (*Value) IsUndefined ¶
func (*Value) LoadFullUseDefChain ¶ added in v1.3.1
func (*Value) RecursiveDepends ¶ added in v1.3.1
RecursiveDepends is used to get all the dependencies of the value
func (*Value) RecursiveDependsAndEffects ¶ added in v1.3.1
func (*Value) RecursiveEffects ¶ added in v1.3.1
RecursiveEffects is used to get all the effects of the value
func (*Value) SetContextValue ¶ added in v1.3.0
func (*Value) ShortString ¶ added in v1.3.1
func (*Value) ShowBacktrack ¶ added in v1.3.1
func (v *Value) ShowBacktrack()
func (*Value) ShowUseDefChain ¶
func (v *Value) ShowUseDefChain()
func (*Value) ShowWithSource ¶
func (i *Value) ShowWithSource()
func (*Value) StringWithSource ¶
type Values ¶
type Values []*Value
func FindFlexibleCommonDepends ¶ added in v1.3.1
func FindStrictCommonDepends ¶ added in v1.3.1
func (Values) AppendDependOn ¶ added in v1.3.1
func (Values) AppendEffectOn ¶ added in v1.3.1
func (Values) FlexibleDepends ¶ added in v1.3.1
func (Values) FullUseDefChain ¶ added in v1.3.1
func (Values) GetBottomUses ¶ added in v1.3.1
func (Values) GetTopDefs ¶ added in v1.3.0
func (v Values) GetTopDefs(opts ...OperationOption) Values
func (Values) ShowWithSource ¶
Click to show internal directories.
Click to hide internal directories.