
* proc: refactor BinaryInfo part of proc.Process to own type The data structures and associated code used by proc.Process to implement target.BinaryInfo will also be useful to support a backend for examining core dumps, split this part of proc.Process to a different type. * proc: compile support for all executable formats unconditionally So far we only compiled in support for loading the executable format supported by the host operating system. Once support for core files is introduced it is however useful to support loading in all executable formats, there is no reason why it shouldn't be possible to examine a linux coredump on windows, or viceversa. * proc: bugfix: do not resume threads on detach if killing * Replace BinaryInfo interface with BinInfo() method returning proc.BinaryInfo
77 lines
1.9 KiB
Go
77 lines
1.9 KiB
Go
package target
|
|
|
|
import (
|
|
"debug/gosym"
|
|
"go/ast"
|
|
|
|
"github.com/derekparker/delve/pkg/proc"
|
|
)
|
|
|
|
// Target represents the target of the debugger. This
|
|
// target could be a system process, core file, etc.
|
|
type Interface interface {
|
|
Info
|
|
ProcessManipulation
|
|
BreakpointManipulation
|
|
VariableEval
|
|
}
|
|
|
|
// Info is an interface that provides general information on the target.
|
|
type Info interface {
|
|
Pid() int
|
|
Exited() bool
|
|
Running() bool
|
|
BinInfo() *proc.BinaryInfo
|
|
|
|
ThreadInfo
|
|
GoroutineInfo
|
|
|
|
FindFileLocation(fileName string, lineNumber int) (uint64, error)
|
|
FirstPCAfterPrologue(fn *gosym.Func, sameline bool) (uint64, error)
|
|
FindFunctionLocation(funcName string, firstLine bool, lineOffset int) (uint64, error)
|
|
}
|
|
|
|
// ThreadInfo is an interface for getting information on active threads
|
|
// in the process.
|
|
type ThreadInfo interface {
|
|
Threads() map[int]*proc.Thread
|
|
CurrentThread() *proc.Thread
|
|
}
|
|
|
|
// GoroutineInfo is an interface for getting information on running goroutines.
|
|
type GoroutineInfo interface {
|
|
GoroutinesInfo() ([]*proc.G, error)
|
|
SelectedGoroutine() *proc.G
|
|
FindGoroutine(int) (*proc.G, error)
|
|
}
|
|
|
|
// ProcessManipulation is an interface for changing the execution state of a process.
|
|
type ProcessManipulation interface {
|
|
Continue() error
|
|
Next() error
|
|
Step() error
|
|
StepOut() error
|
|
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 {
|
|
Breakpoints() map[uint64]*proc.Breakpoint
|
|
SetBreakpoint(addr uint64, kind proc.BreakpointKind, cond ast.Expr) (*proc.Breakpoint, error)
|
|
ClearBreakpoint(addr uint64) (*proc.Breakpoint, error)
|
|
ClearInternalBreakpoints() error
|
|
}
|
|
|
|
// VariableEval is an interface for dealing with eval scopes.
|
|
type VariableEval interface {
|
|
ConvertEvalScope(gid, frame int) (*proc.EvalScope, error)
|
|
}
|
|
|
|
var _ Interface = &proc.Process{}
|