tracer

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInterrupted = errors.New("interrupted")

ErrInterrupted indicates the tracer is interrupted due to the Interrupt() call.

Functions

This section is empty.

Types

type Attributes

type Attributes tracee.Attributes

Attributes represents the tracee's attributes.

type Breakpoints

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

Breakpoints manages the breakpoints. The breakpoint can be conditional, which means the breakpoint is considered as hit only when the specific conditions are met.

func NewBreakpoints

func NewBreakpoints(setBreakpiont, clearBreakpiont func(addr uint64) error) Breakpoints

NewBreakpoints returns new Breakpoints. Pass the functions to actually set and clear breakpoints.

func (Breakpoints) Clear

func (b Breakpoints) Clear(addr uint64) error

Clear clears the breakpoint at the specified address. Conditonal breakpoints for the same address are also cleared.

func (Breakpoints) ClearAllByGoRoutineID

func (b Breakpoints) ClearAllByGoRoutineID(goRoutineID int64) error

ClearAllByGoRoutineID clears all the breakpoints associated with the specified go routine.

func (Breakpoints) ClearConditional

func (b Breakpoints) ClearConditional(addr uint64, goRoutineID int64) error

ClearConditional clears the conditional breakpoint for the specified address and go routine. The physical breakpoint for the specified address may still exist if other conditional breakpoints specify to that address.

func (Breakpoints) Exist

func (b Breakpoints) Exist(addr uint64) bool

Exist returns true if the breakpoint exists.

func (Breakpoints) Hit

func (b Breakpoints) Hit(addr uint64, goRoutineID int64) bool

Hit returns true if the breakpoint is not conditional or the condtional breakpoint meets its condition.

func (Breakpoints) Set

func (b Breakpoints) Set(addr uint64) error

Set sets the breakpoint at the specified address. If `SetConditional` is called before for the same address, the conditions are removed.

func (Breakpoints) SetConditional

func (b Breakpoints) SetConditional(addr uint64, goRoutineID int64) error

SetConditional sets the conditional breakpoint which only the specified go routine is considered as hit. If `Set` is called before for the same address, this function is no-op.

type Controller

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

Controller controls the associated tracee process.

func NewController

func NewController() *Controller

NewController returns the new controller.

func (*Controller) AddEndTracePoint

func (c *Controller) AddEndTracePoint(endAddr uint64) error

AddEndTracePoint adds the ending point of the tracing. The go routines which passed one of the ending points are not traced anymore.

func (*Controller) AddStartTracePoint

func (c *Controller) AddStartTracePoint(startAddr uint64) error

AddStartTracePoint adds the starting point of the tracing. The go routines which passed one of the starting points before are traced.

func (*Controller) AttachTracee

func (c *Controller) AttachTracee(pid int, attrs Attributes) error

AttachTracee attaches to the existing process.

func (*Controller) Interrupt

func (c *Controller) Interrupt()

Interrupt interrupts the main loop.

func (*Controller) LaunchTracee

func (c *Controller) LaunchTracee(name string, arg []string, attrs Attributes) error

LaunchTracee launches the new tracee process to be controlled.

func (*Controller) MainLoop

func (c *Controller) MainLoop() error

MainLoop repeatedly lets the tracee continue and then wait an event. It returns ErrInterrupted error if the trace ends due to the interrupt.

func (*Controller) SetParseLevel

func (c *Controller) SetParseLevel(level int)

SetParseLevel sets the parsing level, which determines how deeply the parser parses the value of args.

func (*Controller) SetTraceLevel

func (c *Controller) SetTraceLevel(level int)

SetTraceLevel set the tracing level, which determines whether to print the traced info of the functions. The traced info is printed if the function is (directly or indirectly) called by the trace point function AND the stack depth is within the `level`. The depth here is the relative value from the point the tracing starts.

Jump to

Keyboard shortcuts

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