gdb

package module
v0.0.0-...-52c4641 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SoftwareBreakpoint core.BreakpointType = iota
	HardwareBreakpoint
	WriteWatchpoint
	ReadWatchpoint
	AccessWatchpoint
)
View Source
const (
	SignalReply    core.ReplyType = 'S'
	StatusReply    core.ReplyType = 'T'
	ExitReply      core.ReplyType = 'W'
	TerminateReply core.ReplyType = 'X'
	DataReply      core.ReplyType = 'O'
	InvalidReply   core.ReplyType = '!'
)

Variables

This section is empty.

Functions

func BuildPacket

func BuildPacket(data []byte) []byte

func PacketChecksum

func PacketChecksum(data []byte) uint8

func ReadPacket

func ReadPacket(r io.Reader) ([]byte, error)

func ReadRegister

func ReadRegister(r io.Reader, definition *core.Register) (core.RegisterValue, error)

func ReadRegisters

func ReadRegisters(r io.Reader, architecture *Architecture) ([]core.RegisterValue, error)

func WritePacket

func WritePacket(w io.Writer, data []byte) error

func WriteRegister

func WriteRegister(w io.Writer, reg *core.RegisterValue) error

func WriteRegisters

func WriteRegisters(w io.Writer, regs []core.RegisterValue) error

Types

type Architecture

type Architecture struct {
	Registers core.Registers
	PC        *core.Register
}

func NewArchitecture

func NewArchitecture() *Architecture

func ReadArchitecture

func ReadArchitecture(r io.Reader) (*Architecture, error)

func (*Architecture) FormatAddress

func (arch *Architecture) FormatAddress(addr uint) string

func (*Architecture) PointerBitSize

func (arch *Architecture) PointerBitSize() uint

type GDBConnection

type GDBConnection interface {
	io.ReadWriteCloser

	SetDeadline(t time.Time) error
}

type GDBFeature

type GDBFeature struct {
	Enabled bool
	Value   string
}

func ParseFeature

func ParseFeature(data string) (string, GDBFeature, error)

type GDBFeatures

type GDBFeatures = map[string]GDBFeature

func ParseFeatures

func ParseFeatures(data string) (GDBFeatures, error)

type GDBRSP

type GDBRSP struct {
	Conn GDBConnection

	Target *Target

	ThreadID    uint32
	Breakpoints core.Breakpoints

	Stopped    bool
	ExitCode   uint
	SignalCode uint
}

func NewGDBRSP

func NewGDBRSP(conn GDBConnection) *GDBRSP

func Remote

func Remote(ctx context.Context, host string, port uint16) (*GDBRSP, error)

func (*GDBRSP) AddAccessWatchpoint

func (gdb *GDBRSP) AddAccessWatchpoint(ctx context.Context, address uint, length uint, handler core.BreakpointHandler) (*core.Breakpoint, error)

func (*GDBRSP) AddBreakpoint

func (gdb *GDBRSP) AddBreakpoint(ctx context.Context, t core.BreakpointType, address uint, byteLength uint, handler core.BreakpointHandler) (*core.Breakpoint, error)

func (*GDBRSP) AddHardwareBreakpoint

func (gdb *GDBRSP) AddHardwareBreakpoint(ctx context.Context, address uint, handler core.BreakpointHandler) (*core.Breakpoint, error)

func (*GDBRSP) AddReadWatchpoint

func (gdb *GDBRSP) AddReadWatchpoint(ctx context.Context, address uint, length uint, handler core.BreakpointHandler) (*core.Breakpoint, error)

func (*GDBRSP) AddSoftwareBreakpoint

func (gdb *GDBRSP) AddSoftwareBreakpoint(ctx context.Context, address uint, handler core.BreakpointHandler) (*core.Breakpoint, error)

func (*GDBRSP) AddWriteWatchpoint

func (gdb *GDBRSP) AddWriteWatchpoint(ctx context.Context, address uint, length uint, handler core.BreakpointHandler) (*core.Breakpoint, error)

func (*GDBRSP) Close

func (gdb *GDBRSP) Close()

func (*GDBRSP) Continue

func (gdb *GDBRSP) Continue(ctx context.Context) error

func (*GDBRSP) ContinueAt

func (gdb *GDBRSP) ContinueAt(ctx context.Context, address uint) error

func (*GDBRSP) GetRegister

func (gdb *GDBRSP) GetRegister(name string) (*core.Register, error)

func (*GDBRSP) Interrupt

func (gdb *GDBRSP) Interrupt(ctx context.Context) error

func (*GDBRSP) ProcessReply

func (gdb *GDBRSP) ProcessReply(ctx context.Context, p []byte) (core.ReplyType, error)

func (*GDBRSP) QuerySupported

func (gdb *GDBRSP) QuerySupported(ctx context.Context) (GDBFeatures, error)

func (*GDBRSP) QueryTarget

func (gdb *GDBRSP) QueryTarget(ctx context.Context) (*Target, error)

func (*GDBRSP) QueryTargetPartial

func (gdb *GDBRSP) QueryTargetPartial(ctx context.Context) (*Target, error)

func (*GDBRSP) ReadFeature

func (gdb *GDBRSP) ReadFeature(ctx context.Context, path string) ([]byte, error)

func (*GDBRSP) ReadMemory

func (gdb *GDBRSP) ReadMemory(ctx context.Context, address uint, length uint) ([]byte, error)

func (*GDBRSP) ReadRegister

func (gdb *GDBRSP) ReadRegister(ctx context.Context, reg *core.Register) (core.RegisterValue, error)

func (*GDBRSP) ReadRegisterIndex

func (gdb *GDBRSP) ReadRegisterIndex(ctx context.Context, index uint) (core.RegisterValue, error)

func (*GDBRSP) ReadRegisters

func (gdb *GDBRSP) ReadRegisters(ctx context.Context) ([]core.RegisterValue, error)

func (*GDBRSP) ReadRegistersRaw

func (gdb *GDBRSP) ReadRegistersRaw(ctx context.Context) ([]byte, error)

func (*GDBRSP) RecvResponse

func (gdb *GDBRSP) RecvResponse(ctx context.Context) ([]byte, error)

func (*GDBRSP) RemoveBreakpoint

func (gdb *GDBRSP) RemoveBreakpoint(ctx context.Context, b *core.Breakpoint) error

func (*GDBRSP) Run

func (gdb *GDBRSP) Run(ctx context.Context) error

func (*GDBRSP) SendCommand

func (gdb *GDBRSP) SendCommand(ctx context.Context, data string) error

func (*GDBRSP) SendRawCommand

func (gdb *GDBRSP) SendRawCommand(ctx context.Context, data []byte) error

func (*GDBRSP) Step

func (gdb *GDBRSP) Step(ctx context.Context) error

func (*GDBRSP) StepAt

func (gdb *GDBRSP) StepAt(ctx context.Context, address uint) error

func (*GDBRSP) Update

func (gdb *GDBRSP) Update(ctx context.Context) error

func (*GDBRSP) WaitForReply

func (gdb *GDBRSP) WaitForReply(ctx context.Context) (core.ReplyType, error)

func (*GDBRSP) WriteMemory

func (gdb *GDBRSP) WriteMemory(ctx context.Context, address uint, data []byte) error

func (*GDBRSP) WriteRegister

func (gdb *GDBRSP) WriteRegister(ctx context.Context, regVal core.RegisterValue) error

func (*GDBRSP) WriteRegisterIndex

func (gdb *GDBRSP) WriteRegisterIndex(ctx context.Context, index uint, data []byte) error

func (*GDBRSP) WriteRegisters

func (gdb *GDBRSP) WriteRegisters(ctx context.Context, regs []core.RegisterValue) error

type Target

type Target struct {
	Name string
	Path string
	Arch *Architecture
}

func NewTarget

func NewTarget() *Target

func ReadTarget

func ReadTarget(r io.Reader) (*Target, error)

Jump to

Keyboard shortcuts

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