debugapi

package
v0.0.0-...-80bf894 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExitEvent

func IsExitEvent(event EventType) bool

IsExitEvent returns true if the event indicates the process exits for some reason.

Types

type Client

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

Client is the client proxy in order to execute the ptrace requests in the only one go routine. It is because the tracer thread must remain same, which is the limitation of ptrace.

func NewClient

func NewClient() *Client

NewClient returns the new client proxy.

func (*Client) AttachProcess

func (c *Client) AttachProcess(pid int) (err error)

func (*Client) ContinueAndWait

func (c *Client) ContinueAndWait() (ev Event, err error)

func (*Client) DetachProcess

func (c *Client) DetachProcess() (err error)

func (*Client) LaunchProcess

func (c *Client) LaunchProcess(name string, arg ...string) (err error)

func (*Client) ReadMemory

func (c *Client) ReadMemory(addr uint64, out []byte) (err error)

func (*Client) ReadRegisters

func (c *Client) ReadRegisters(threadID int) (regs Registers, err error)

func (*Client) ReadTLS

func (c *Client) ReadTLS(threadID int, offset int32) (addr uint64, err error)

func (*Client) StepAndWait

func (c *Client) StepAndWait(threadID int) (ev Event, err error)

func (*Client) WriteMemory

func (c *Client) WriteMemory(addr uint64, data []byte) (err error)

func (*Client) WriteRegisters

func (c *Client) WriteRegisters(threadID int, regs Registers) (err error)

type Event

type Event struct {
	Type EventType
	// Data is one of these go types:
	//
	//    EventType            Go type     Description
	//    -----------          -------     -----------
	//    EventTypeTrapped     []int       A list of trapped thread id
	//    EventTypeCoreDump    NA          NA
	//    EventTypeExited      int         Exit status
	//    EventTypeTerminated  int         Signal number
	Data interface{}
}

Event describes the event happens to the target process.

type EventType

type EventType int

EventType represents the type of the event.

const (
	// EventTypeTrapped event happens when the process is trapped.
	EventTypeTrapped EventType = iota
	// EventTypeCoreDump event happens when the process terminates unexpectedly.
	EventTypeCoreDump
	// EventTypeExited event happens when the process exits.
	EventTypeExited
	// EventTypeTerminated event happens when the process is terminated by a signal.
	EventTypeTerminated
)

type Registers

type Registers struct {
	Rip uint64
	Rsp uint64
	Rcx uint64
}

Registers represents the target's registers.

type UnspecifiedThreadError

type UnspecifiedThreadError struct {
	ThreadIDs []int
}

UnspecifiedThreadError indicates the stopped threads include unspecified ones.

func (UnspecifiedThreadError) Error

func (e UnspecifiedThreadError) Error() string

Error returns the list of unspecified threads.

Jump to

Keyboard shortcuts

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