ptrace

package
v0.12.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MADV_POPULATE_READ.
	MadvisePopulateRead = 0x16
	// MADV_POPULATE_WRITE.
	MadvisePopulateWrite = 0x17
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TracedProgram

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

TracedProgram is a program traced by ptrace.

func NewTracedProgram

func NewTracedProgram(pid int, logger logr.Logger) (*TracedProgram, error)

NewTracedProgram ptrace all threads of a process.

func (*TracedProgram) Detach

func (p *TracedProgram) Detach() error

Detach detaches from all threads of the processes.

func (*TracedProgram) Madvise

func (p *TracedProgram) Madvise(addr uint64, length uint64) error

Madvise runs madvise syscall.

func (*TracedProgram) Mlock

func (p *TracedProgram) Mlock(addr uint64, length uint64) error

Mlock runs mlock syscall.

func (*TracedProgram) Mmap

func (p *TracedProgram) Mmap(length uint64, fd uint64) (uint64, error)

Mmap runs mmap syscall.

func (*TracedProgram) Pid

func (p *TracedProgram) Pid() int

Pid return the pid of traced program.

func (*TracedProgram) Protect

func (p *TracedProgram) Protect() error

Protect will backup regs and rip into fields.

func (*TracedProgram) Restore

func (p *TracedProgram) Restore() error

Restore will restore regs and rip from fields.

func (*TracedProgram) SetMemLockInfinity

func (p *TracedProgram) SetMemLockInfinity() error

SetMemLockInfinity sets the memlock rlimit to infinity.

func (*TracedProgram) Step

func (p *TracedProgram) Step() error

Step moves one step forward.

func (*TracedProgram) Syscall

func (p *TracedProgram) Syscall(number uint64, args ...uint64) (uint64, error)

Syscall runs a syscall at main thread of process.

func (*TracedProgram) Wait

func (p *TracedProgram) Wait() error

Wait waits until the process stops.

Jump to

Keyboard shortcuts

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