ptrace

package
v0.0.0-...-38845ac Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Trace

func Trace(pid int, handler TracerHandler)

Types

type Fd

type Fd int

func (Fd) String

func (fd Fd) String() string

type FlagFcntlCmd

type FlagFcntlCmd int

func (FlagFcntlCmd) String

func (f FlagFcntlCmd) String() string

type FlagOpen

type FlagOpen int

func (FlagOpen) String

func (f FlagOpen) String() string

type ParamType

type ParamType int

Syscall param

const (
	ParamTypeAny          ParamType = iota // placeholder
	ParamTypeInt                           // int
	ParamTypePath                          // a pointer to char* path
	ParamTypePipeFd                        // int pipefd[2]
	ParamTypeFd                            // int fd
	ParamTypeFlagOpen                      // flag for #open
	ParamTypeFlagFnctlCmd                  // cmd for #fnctl

)

Syscall param - all available values

func (ParamType) String

func (i ParamType) String() string

type Syscall

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

Syscall func

func GetSyscall

func GetSyscall(pid int) (*Syscall, error)

func (*Syscall) GetArg

func (c *Syscall) GetArg(pos int) *SyscallArg

Syscall func - attr reader for arg in specified postion

func (*Syscall) GetArgs

func (c *Syscall) GetArgs() []*SyscallArg

Syscall func - attr reader for args

func (*Syscall) GetNR

func (c *Syscall) GetNR() uint

Syscall func - attr reader for nr

func (*Syscall) GetName

func (c *Syscall) GetName() string

Syscall func - attr reader for name

func (*Syscall) GetRetval

func (c *Syscall) GetRetval() *SyscallRetval

Syscall func - attr reader for retval

func (*Syscall) ReadArgs

func (c *Syscall) ReadArgs() error

Syscall func - read all args value from register

func (*Syscall) ReadRetval

func (c *Syscall) ReadRetval() error

Syscall func - read retval value from register

type SyscallArg

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

Syscall arg

func (*SyscallArg) GetFd

func (a *SyscallArg) GetFd() int

Syscall arg - convert value to Fd

func (*SyscallArg) GetFlag

func (a *SyscallArg) GetFlag() int

Syscall arg - convert value to Flag

func (*SyscallArg) GetInt

func (a *SyscallArg) GetInt() int

Syscall arg - convert value to int

func (*SyscallArg) GetPath

func (a *SyscallArg) GetPath() string

Syscall arg - convert value to Path

func (*SyscallArg) GetPipeFd

func (a *SyscallArg) GetPipeFd() []int

Syscall arg - convert value to PipeFd

func (*SyscallArg) IsParamType

func (a *SyscallArg) IsParamType(t ParamType) bool

Syscall arg - check param type

func (*SyscallArg) String

func (a *SyscallArg) String() string

Syscall func - interface Stringer

type SyscallRetval

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

Syscall retval

func (*SyscallRetval) GetErrno

func (r *SyscallRetval) GetErrno() syscall.Errno

Syscall retval - attr reader for errno

func (*SyscallRetval) GetValue

func (r *SyscallRetval) GetValue() int

Syscall retval - attr reader for value

func (*SyscallRetval) HasError

func (r *SyscallRetval) HasError() bool

Syscall retval - check errno

func (*SyscallRetval) HasError_ENOSYS

func (r *SyscallRetval) HasError_ENOSYS() bool

Syscall retval - check errno ENOSYS

func (*SyscallRetval) String

func (r *SyscallRetval) String() string

Syscall retval - interface Stringer

type SyscallSignature

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

Syscall func signature

type Tracee

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

type Tracer

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

type TracerHandler

type TracerHandler interface {
	HandleTracerLogging(pid int, msg string)                                              // logging
	HandleTracerPanicEvent(err error)                                                     // panic
	HandleTracerExitedEvent(pid int, ws syscall.WaitStatus, rusage syscall.Rusage)        // ws.Exited()
	HandleTracerSignaledEvent(pid int, ws syscall.WaitStatus, rusage syscall.Rusage)      // ws.Signaled()
	HandleTracerNewChildEvent(pid int, childPid int)                                      // PTRACE_EVENT_CLONE
	HandleTracerSyscallEnterEvent(pid int, curr *Syscall) (continued bool)                // when syscall enter
	HandleTracerSyscallLeaveEvent(pid int, curr *Syscall, prev *Syscall) (continued bool) // when syscall leave
}

Jump to

Keyboard shortcuts

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