ssadb

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteProgram

func DeleteProgram(db *gorm.DB, program string)

func SaveVariable

func SaveVariable(db *gorm.DB, program, variable string, instIDs []int64) error

Types

type Int64Map

type Int64Map map[int64]int64

func (*Int64Map) Scan

func (m *Int64Map) Scan(value any) error

func (Int64Map) Value

func (m Int64Map) Value() (driver.Value, error)

type Int64Slice

type Int64Slice []int64

Int64Slice 是一个自定义类型,用于处理 []int64 的序列化和反序列化

func (*Int64Slice) Scan

func (us *Int64Slice) Scan(value interface{}) error

Scan 实现了 sql.Scanner 接口,允许从数据库读取值时将其转换回 Int64Slice 类型

func (Int64Slice) Value

func (us Int64Slice) Value() (driver.Value, error)

Value 实现了 driver.Valuer 接口,允许将 Int64Slice 转换为一个适合存储在数据库中的形式

type IrCode

type IrCode struct {
	gorm.Model

	ProgramName string `json:"program_name" gorm:"index"`
	PackageName string `json:"package_name" gorm:"index"`

	// source code
	SourceCodeFile      string `json:"source_code_file"`
	SourceCodeStartLine int64  `json:"source_code_start_line"`
	SourceCodeEndLine   int64  `json:"source_code_end_line"`
	SourceCodeStartCol  int64  `json:"source_code_start_col"`
	SourceCodeEndCol    int64  `json:"source_code_end_col"`
	SourceCodeHash      string `json:"source_code_hash"`

	// opcode
	Opcode         int64  `json:"opcode"`
	OpcodeName     string `json:"opcode_name"`
	OpcodeOperator string `json:"opcode_operator"`

	// basic info
	Name             string `json:"name"`
	VerboseName      string `json:"verbose_name"`
	ShortVerboseName string `json:"short_verbose_name"`

	// any IrCode in one function
	CurrentBlock    int64 `json:"current_block"`
	CurrentFunction int64 `json:"current_function"`

	// FunctionDefs
	IsFunction       bool       `json:"is_function"`
	FormalArgs       Int64Slice `json:"formal_args" gorm:"type:text"`
	IsVariadic       bool       `json:"is_variadic"`
	ReturnCodes      Int64Slice `json:"return_codes" gorm:"type:text"`
	SideEffects      Int64Slice `json:"side_effects" gorm:"type:text"`
	IsExternal       bool       `json:"is_external"`
	IsCalledBy       Int64Slice `json:"is_called_by" gorm:"type:text"`
	CodeBlocks       Int64Slice `json:"code_blocks" gorm:"type:text"`
	EnterBlock       int64      `json:"enter_block"`
	ExitBlock        int64      `json:"exit_block"`
	DeferBlock       int64      `json:"defer_block"`
	ChildrenFunction Int64Slice `json:"children_function" gorm:"type:text"`
	ParentFunction   int64      `json:"parent_function"`

	// block
	IsBlock   bool       `json:"is_block"`
	PredBlock Int64Slice `json:"pred_block" gorm:"type:text"`
	SuccBlock Int64Slice `json:"succ_block" gorm:"type:text"`
	Phis      Int64Slice `json:"phis_in_block" gorm:"type:text"`

	// Use-Def Chains Relation
	Defs  Int64Slice `json:"defs" gorm:"type:text"`
	Users Int64Slice `json:"users" gorm:"type:text"`

	// OOP Supporting
	IsObject       bool
	IsObjectMember bool
	ObjectMembers  Int64Map `json:"object_members" gorm:"type:text"`
	ObjectParent   int64    `json:"object_parent"`

	// Maskable
	MaskedCodes Int64Slice `json:"masked_codes" gorm:"type:text"`
	IsMasked    bool       `json:"is_masked"`

	// Called
	IsCalled   bool       `json:"is_called"`
	ActualArgs Int64Slice `json:"actual_args" gorm:"type:text"`

	// Variable
	Variable StringSlice `json:"variable" gorm:"type:text"`

	// Constant
	ConstantValue string `json:"constant_value" gorm:"type:text"`
}

func GetIrByVariable

func GetIrByVariable(db *gorm.DB, program, name string) []*IrCode

func GetIrCodeById

func GetIrCodeById(db *gorm.DB, id int64) *IrCode

func RequireIrCode

func RequireIrCode(db *gorm.DB, program string) (uint, *IrCode)

type IrVariable

type IrVariable struct {
	gorm.Model

	ProgramName  string `json:"program_name" gorm:"index"`
	VariableName string `json:"variable_name" gorm:"index"`

	InstructionID Int64Slice `json:"instruction_id" gorm:"type:text"`
}

type StringSlice

type StringSlice []string

func (*StringSlice) Scan

func (ss *StringSlice) Scan(value interface{}) error

func (StringSlice) Value

func (us StringSlice) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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