2015-06-12 19:49:23 +00:00
|
|
|
package proc
|
2015-04-29 17:07:27 +00:00
|
|
|
|
2017-10-05 07:26:19 +00:00
|
|
|
import (
|
2019-01-04 18:39:25 +00:00
|
|
|
"github.com/go-delve/delve/pkg/dwarf/frame"
|
|
|
|
"github.com/go-delve/delve/pkg/dwarf/op"
|
2017-10-05 07:26:19 +00:00
|
|
|
)
|
|
|
|
|
2016-01-10 08:57:52 +00:00
|
|
|
// Arch defines an interface for representing a
|
|
|
|
// CPU architecture.
|
2015-04-29 17:07:27 +00:00
|
|
|
type Arch interface {
|
2020-03-28 17:39:32 +00:00
|
|
|
// PtrSize returns the size of a pointer for the architecture.
|
2015-04-29 17:07:27 +00:00
|
|
|
PtrSize() int
|
2020-03-28 17:39:32 +00:00
|
|
|
// MaxInstructionLength is the maximum size in bytes of an instruction.
|
2019-11-28 12:54:39 +00:00
|
|
|
MaxInstructionLength() int
|
2020-03-28 17:39:32 +00:00
|
|
|
// AsmDecode decodes the assembly instruction starting at mem[0:] into asmInst.
|
|
|
|
// It assumes that the Loc and AtPC fields of asmInst have already been filled.
|
2019-11-28 12:54:39 +00:00
|
|
|
AsmDecode(asmInst *AsmInstruction, mem []byte, regs Registers, memrw MemoryReadWriter, bi *BinaryInfo) error
|
2020-03-28 17:39:32 +00:00
|
|
|
// Prologues returns a list of stack split prologues
|
|
|
|
// that are inserted at function entry.
|
2019-11-28 12:54:39 +00:00
|
|
|
Prologues() []opcodeSeq
|
2020-03-28 17:39:32 +00:00
|
|
|
// BreakpointInstruction is the instruction that will trigger a breakpoint trap for
|
|
|
|
// the given architecture.
|
2015-04-29 17:07:27 +00:00
|
|
|
BreakpointInstruction() []byte
|
2020-03-28 17:39:32 +00:00
|
|
|
// BreakInstrMovesPC is true if hitting the breakpoint instruction advances the
|
|
|
|
// instruction counter by the size of the breakpoint instruction.
|
2019-11-16 12:25:13 +00:00
|
|
|
BreakInstrMovesPC() bool
|
2020-03-28 17:39:32 +00:00
|
|
|
// BreakpointSize is the size of the breakpoint instruction for the given architecture.
|
2015-04-29 17:07:27 +00:00
|
|
|
BreakpointSize() int
|
2020-03-28 17:39:32 +00:00
|
|
|
// DerefTLS is true if the G struct stored in the TLS section is a pointer
|
|
|
|
// and the address must be dereferenced to find to actual G struct.
|
2017-02-15 13:41:03 +00:00
|
|
|
DerefTLS() bool
|
2020-03-28 17:39:32 +00:00
|
|
|
// FixFrameUnwindContext applies architecture specific rules for unwinding a stack frame
|
|
|
|
// on the given arch.
|
2019-08-08 03:15:20 +00:00
|
|
|
FixFrameUnwindContext(*frame.FrameContext, uint64, *BinaryInfo) *frame.FrameContext
|
2020-03-28 17:39:32 +00:00
|
|
|
// SwitchStack will use the current frame to determine if it's time to
|
|
|
|
// switch between the system stack and the goroutine stack or vice versa.
|
2020-01-21 17:11:20 +00:00
|
|
|
SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool
|
2020-03-28 17:39:32 +00:00
|
|
|
// RegSize returns the size (in bytes) of register regnum.
|
2017-10-05 07:26:19 +00:00
|
|
|
RegSize(uint64) int
|
2020-03-28 17:39:32 +00:00
|
|
|
// RegistersToDwarfRegisters maps hardware registers to DWARF registers.
|
2019-08-08 03:15:20 +00:00
|
|
|
RegistersToDwarfRegisters(uint64, Registers) op.DwarfRegisters
|
2020-03-28 17:39:32 +00:00
|
|
|
// AddrAndStackRegsToDwarfRegisters returns DWARF registers from the passed in
|
|
|
|
// PC, SP, and BP registers in the format used by the DWARF expression interpreter.
|
2020-01-21 17:11:20 +00:00
|
|
|
AddrAndStackRegsToDwarfRegisters(uint64, uint64, uint64, uint64, uint64) op.DwarfRegisters
|
2020-03-28 17:39:32 +00:00
|
|
|
// DwarfRegisterToString returns the name and value representation of the given register.
|
2020-02-24 18:47:02 +00:00
|
|
|
DwarfRegisterToString(int, *op.DwarfRegister) (string, bool, string)
|
2020-03-28 17:39:32 +00:00
|
|
|
// InhibitStepInto returns whether StepBreakpoint can be set at pc.
|
2020-03-10 16:34:40 +00:00
|
|
|
InhibitStepInto(bi *BinaryInfo, pc uint64) bool
|
2015-04-29 17:07:27 +00:00
|
|
|
}
|
|
|
|
|
2020-03-10 16:34:40 +00:00
|
|
|
// crosscall2 is defined in $GOROOT/src/runtime/cgo/asm_amd64.s.
|
2017-09-01 13:34:13 +00:00
|
|
|
const (
|
|
|
|
crosscall2SPOffsetBad = 0x8
|
|
|
|
crosscall2SPOffsetWindows = 0x118
|
|
|
|
crosscall2SPOffsetNonWindows = 0x58
|
|
|
|
)
|