debugger

package
v0.0.0-...-c8b2c4c Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Debugger

type Debugger struct {
	TargetFile    string
	Line          int
	PC            uint64
	Fn            *gosym.Func
	SymTable      *gosym.Table
	Regs          syscall.PtraceRegs
	Ws            syscall.WaitStatus
	OriginalCode  []byte
	BreakpointSet bool
	InterruptCode []byte

	DebuggerInterface
}

Debugger holds the state of the debugger.

func NewDebugger

func NewDebugger() *Debugger

NewDebugger initializes a new Debugger instance.

func (*Debugger) GetSymbolTable

func (d *Debugger) GetSymbolTable(prog string) *gosym.Table

GetSymbolTable retrieves the symbol table from the specified executable.

func (*Debugger) InputOrContinue

func (d *Debugger) InputOrContinue(pid int) bool

InputOrContinue gets user input to determine whether to continue, step, set a breakpoint, or quit.

func (*Debugger) OutputStack

func (d *Debugger) OutputStack(pid int, ip uint64, sp uint64, bp uint64)

OutputStack outputs the call stack information.

func (*Debugger) ReplaceCode

func (d *Debugger) ReplaceCode(pid int, address uint64, code []byte) []byte

ReplaceCode replaces the code at the specified address with new code.

func (*Debugger) Run

func (d *Debugger) Run()

Run starts the debugging session.

func (*Debugger) RunTarget

func (d *Debugger) RunTarget(target string)

RunTarget starts the target executable and handles the debugging session.

func (*Debugger) SetBreak

func (d *Debugger) SetBreak(pid int) (bool, []byte)

SetBreak sets a breakpoint at the specified line.

type DebuggerInterface

type DebuggerInterface interface {
	InputOrContinue(pid int) bool
	SetBreak(pid int) (bool, []byte)
	ReplaceCode(pid int, address uint64, code []byte) []byte
	GetSymbolTable(prog string) *gosym.Table
	OutputStack(pid int, ip uint64, sp uint64, bp uint64)
	RunTarget(target string)
	Run()
}

Jump to

Keyboard shortcuts

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