2017-04-21 07:50:38 +00:00
|
|
|
package proc
|
2017-02-08 00:23:47 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"go/ast"
|
|
|
|
)
|
|
|
|
|
2017-04-21 07:50:38 +00:00
|
|
|
// Process represents the target of the debugger. This
|
2017-02-08 00:23:47 +00:00
|
|
|
// target could be a system process, core file, etc.
|
2017-04-21 07:50:38 +00:00
|
|
|
type Process interface {
|
2017-02-08 00:23:47 +00:00
|
|
|
Info
|
|
|
|
ProcessManipulation
|
|
|
|
BreakpointManipulation
|
|
|
|
}
|
|
|
|
|
|
|
|
// Info is an interface that provides general information on the target.
|
|
|
|
type Info interface {
|
|
|
|
Pid() int
|
|
|
|
Exited() bool
|
|
|
|
Running() bool
|
2017-04-21 07:50:38 +00:00
|
|
|
BinInfo() *BinaryInfo
|
2017-02-08 00:23:47 +00:00
|
|
|
|
|
|
|
ThreadInfo
|
|
|
|
GoroutineInfo
|
|
|
|
}
|
|
|
|
|
|
|
|
// ThreadInfo is an interface for getting information on active threads
|
|
|
|
// in the process.
|
|
|
|
type ThreadInfo interface {
|
2017-04-21 07:50:38 +00:00
|
|
|
FindThread(threadID int) (Thread, bool)
|
|
|
|
ThreadList() []Thread
|
|
|
|
CurrentThread() Thread
|
2017-02-08 00:23:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GoroutineInfo is an interface for getting information on running goroutines.
|
|
|
|
type GoroutineInfo interface {
|
2017-04-21 07:50:38 +00:00
|
|
|
SelectedGoroutine() *G
|
2017-02-08 00:23:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ProcessManipulation is an interface for changing the execution state of a process.
|
|
|
|
type ProcessManipulation interface {
|
2017-04-21 07:50:38 +00:00
|
|
|
ContinueOnce() (trapthread Thread, err error)
|
2017-02-08 00:23:47 +00:00
|
|
|
StepInstruction() error
|
|
|
|
SwitchThread(int) error
|
|
|
|
SwitchGoroutine(int) error
|
|
|
|
RequestManualStop() error
|
|
|
|
Halt() error
|
|
|
|
Kill() error
|
|
|
|
Detach(bool) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// BreakpointManipulation is an interface for managing breakpoints.
|
|
|
|
type BreakpointManipulation interface {
|
2017-04-21 07:50:38 +00:00
|
|
|
Breakpoints() map[uint64]*Breakpoint
|
|
|
|
SetBreakpoint(addr uint64, kind BreakpointKind, cond ast.Expr) (*Breakpoint, error)
|
|
|
|
ClearBreakpoint(addr uint64) (*Breakpoint, error)
|
2017-02-08 00:23:47 +00:00
|
|
|
ClearInternalBreakpoints() error
|
|
|
|
}
|
|
|
|
|
|
|
|
// VariableEval is an interface for dealing with eval scopes.
|
|
|
|
type VariableEval interface {
|
2017-04-21 07:50:38 +00:00
|
|
|
FrameToScope(Stackframe) *EvalScope
|
|
|
|
ConvertEvalScope(gid, frame int) (*EvalScope, error)
|
2017-02-08 00:23:47 +00:00
|
|
|
}
|