runtime

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DEBUG              = ""
	ErrUnsupportAction = errors.New("unsupport action")
	ErrPointNotFound   = errors.New("function point not found")
	ErrPatchedAlready  = errors.New("patched already")
)
View Source
var ErrTypeUnsupported = errors.New("type unsupported")
View Source
var (
	ErrUnsupportedType = errors.New("unsupported type")
)

Functions

func CopyToLocation

func CopyToLocation(location uintptr, data []byte)

func DwarfTree

func DwarfTree(dw *dwarf.Data) (map[string]*godwarf.Tree, error)

func GetPtr

func GetPtr(t interface{}) uintptr

func LoadTree

func LoadTree(off dwarf.Offset, dw *dwarf.Data) (*godwarf.Tree, error)

func MakeFunc

func MakeFunc(tree *godwarf.Tree, dw *dwarf.Data) (reflect.Type, error)

func MakeType

func MakeType(typ godwarf.Type, dw *dwarf.Data) (reflect.Type, error)

func MprotectCrossPage

func MprotectCrossPage(addr uintptr, length int, prot int)

func PageStart

func PageStart(ptr uintptr) uintptr

func RawMemoryAccess

func RawMemoryAccess(p uintptr, length int) []byte

Types

type Action

type Action string
const (
	DELAY  Action = "delay"
	PANIC  Action = "panic"
	SET    Action = "set"
	RETURN Action = "return"
)

type ActionFunc

type ActionFunc func(*Runtime, Request) (*Guard, error)

type DelayPoint

type DelayPoint struct {
	HijackPoint `mapstructure:",squash"`
	Val         int
}

type Guard

type Guard struct {
	// contains filtered or unexported fields
}

func Patch

func Patch(target, replacement interface{}) *Guard

func (*Guard) Restore

func (g *Guard) Restore()

func (*Guard) Unpatch

func (g *Guard) Unpatch()

type HijackPoint

type HijackPoint struct {
	Func   string
	Action Action
}

type PanicPoint

type PanicPoint struct {
	HijackPoint `mapstructure:",squash"`
	Val         string
}

type Request

type Request map[string]interface{}

type ReturnPoint

type ReturnPoint struct {
	HijackPoint `mapstructure:",squash"`
	Index       int
	Val         interface{}
}

type Runtime

type Runtime struct {
	M sync.Map
	C chan func()
	// contains filtered or unexported fields
}

func New

func New(pid int) (*Runtime, error)

func (*Runtime) Funcs

func (r *Runtime) Funcs() []string

func (*Runtime) Hijack

func (r *Runtime) Hijack(m Request) error

func (*Runtime) Points

func (r *Runtime) Points() []string

func (*Runtime) Release

func (r *Runtime) Release(fn string)

func (*Runtime) Run

func (r *Runtime) Run(ctx context.Context)

type SetPoint

type SetPoint struct {
	HijackPoint `mapstructure:",squash"`
	Index       int
	Val         interface{}
}

type Tree

type Tree struct {
	godwarf.Entry

	Tag      dwarf.Tag
	Offset   dwarf.Offset
	Children []*Tree
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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