locker

package
v0.0.0-...-f39ad0c Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: GPL-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

View Source
const Edited = "Edited"
View Source
const M_Lock = "M_Lock"
View Source
const M_Unlock = "M_Unlock"
View Source
const RW_Lock = "RW_Lock"
View Source
const RW_RLock = "RW_RLock"
View Source
const RW_RUnlock = "RW_RUnlock"
View Source
const RW_Unlock = "RW_Unlock"
View Source
const Unknown = "Unknown"

Variables

View Source
var INIT_LOCK = &Lock_op{
	Name: "INIT_LOCK",
}

Functions

func Before_map

func Before_map(target_fn *ssa.Function, all_lockers []*Locker, entry_locks []*Lock_op, report_double_lock func(lock1, lock2 *Lock_op)) map[ssa.Instruction][]*Lock_op

func CallName

func CallName(call *ssa.CallCommon) string

func Find_locker_info_inst

func Find_locker_info_inst(inst ssa.Instruction) (name, locker_type, op_type string, is_defer, is_locker bool)

func Is_inst_end_of_fn

func Is_inst_end_of_fn(inst ssa.Instruction) bool

func Scan_lock_inst_return_value_comment

func Scan_lock_inst_return_value_comment(inst ssa.Instruction) (v ssa.Value, comment string)

Types

type Lock_op

type Lock_op struct {
	Name     string
	Inst     ssa.Instruction
	Is_RLock bool
	Is_defer bool

	Wrappers []*Wrapper //This field is specially designed for C6A

	Parent *Locker
}

type Locker

type Locker struct {
	Name    string
	Type    string
	Locks   []*Lock_op
	Unlocks []*Unlock_op
	Pkg     string // Don't use *ssa.Package here! It's not reliable

	Status string
}

func Loop_lockers_to_record_wrappers

func Loop_lockers_to_record_wrappers(all_lockers []*Locker) (result []*Locker)

func Scan_inst_and_record_to_slice

func Scan_inst_and_record_to_slice(lockers []*Locker, inst ssa.Instruction) (result []*Locker, is_locker_op bool)

func (*Locker) Modify_status

func (l *Locker) Modify_status(str string)

type Unlock_op

type Unlock_op struct {
	Name       string
	Inst       ssa.Instruction
	Is_RUnlock bool
	Is_defer   bool

	Parent *Locker
}

type Wrapper

type Wrapper struct {
	Fn     *ssa.Function // When compare two Wrapper, can't directly compare Fn or inst, because pointer will change during each compilation
	Fn_str string
	Inst   ssa.Instruction
	Callee *Wrapper // if callee is nil, then inst is the Lock_op itself, else inst is calling to another Wrapper
	Op     *Lock_op // the wrapped operation
}

Wrapper records a function that "contains" a Lock_op. "Contains" means the function directly uses this Lock_op, or its callee (or callee's callee) uses this Lock_op. The maximum layer is C6A_call_chain_layer_for_lock_wrapper

func Append_wrappers_if_not_in

func Append_wrappers_if_not_in(old []*Wrapper, add *Wrapper) (result []*Wrapper)

Jump to

Keyboard shortcuts

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