Documentation
¶
Index ¶
- Constants
- Variables
- func Align[I constraints.Integer](a, b I) I
- func Register(arch emulator.Arch, ctor DbgCtor) bool
- type Args
- type Calling
- type CodeCallback
- type Context
- type ControlCallback
- type ControlHandler
- type DbgCtor
- type Debugger
- type DebuggerInfo
- type DefaultFileHandler
- func (DefaultFileHandler) Mkdir(name string, perm fs.FileMode) (filesystem.DirFS, error)
- func (DefaultFileHandler) NewSocket(network socket.Network) (socket.Socket, error)
- func (DefaultFileHandler) OpenFile(name string, flag filesystem.FileFlag, perm fs.FileMode) (filesystem.File, error)
- func (DefaultFileHandler) ReadDir(name string) ([]fs.DirEntry, error)
- func (DefaultFileHandler) Readlink(name string) (string, error)
- func (DefaultFileHandler) Stat(name string) (fs.FileInfo, error)
- type FileHandler
- type FileManager
- type HookHandler
- type HookManger
- type HookResult
- type InterruptCallback
- type InterruptException
- type InvalidCallback
- type InvalidInstructionException
- type InvalidMemoryException
- func (e *InvalidMemoryException) Address() uint64
- func (e *InvalidMemoryException) Context() Context
- func (e *InvalidMemoryException) Error() string
- func (e *InvalidMemoryException) Size() uint64
- func (e *InvalidMemoryException) String() string
- func (e *InvalidMemoryException) Type() emulator.HookType
- func (e *InvalidMemoryException) Value() uint64
- type MemoryCallback
- type MemoryContext
- type MemoryManager
- type Module
- type ModuleManager
- type PanicException
- type RegisterContext
- type SimulateException
- func NewInterruptException(ctx Context, intno uint64) SimulateException
- func NewInvalidInstructionException(ctx Context) SimulateException
- func NewInvalidMemoryException(ctx Context, typ emulator.HookType, addr, size, value uint64) SimulateException
- func NewPanicException(ctx Context, v any, stack []byte) SimulateException
- type StorageContext
- type Symbol
- type SymbolIter
- type Task
- type TaskManager
- type TaskStatus
Constants ¶
View Source
const ( Calling_Default = iota Calling_Cdecl Calling_Stdcall Calling_Fastcall Calling_ATPCS = Calling_Fastcall )
Variables ¶
View Source
var ( ErrContextInvalid = errors.New("context invalid") ErrModuleNotFound = errors.New("module not found") ErrSymbolNotFound = errors.New("symbol not found") ErrHookCallbackType = errors.New("hook callback type exception") ErrTaskInvalid = errors.New("task invalid") ErrCallingUnsupported = errors.New("calling unsupported") ErrUnhandledException = errors.New("unhandled exception") ErrArgumentInvalid = errors.New("argument invalid") ErrEmulatorStop = errors.New("emulator stop") ErrAddressInvalid = errors.New("address invalid") ErrNotImplemented = errors.New("not implemented") )
Functions ¶
func Align ¶
func Align[I constraints.Integer](a, b I) I
Types ¶
type CodeCallback ¶
type Context ¶
type Context interface {
Debugger() Debugger
PC() emulator.Reg
SP() emulator.Reg
TaskID() int
ParentID() int
TaskFork() (Task, error)
RegisterContext
GetArgs(calling Calling) (Args, error)
ArgExtract(calling Calling, args ...any) error
ArgWrite(calling Calling, args ...any) error
RetExtract(val any) error
RetWrite(val any) error
Return() error
Goto(addr uint64) error
MemoryContext
StorageContext
}
type ControlCallback ¶
type ControlHandler ¶
type Debugger ¶
type Debugger interface {
io.Closer
DebuggerInfo
MemoryManager
HookManger
TaskManager
ModuleManager
FileManager
}
type DebuggerInfo ¶
type DefaultFileHandler ¶
type DefaultFileHandler struct {
}
func (DefaultFileHandler) Mkdir ¶
func (DefaultFileHandler) Mkdir(name string, perm fs.FileMode) (filesystem.DirFS, error)
func (DefaultFileHandler) OpenFile ¶
func (DefaultFileHandler) OpenFile(name string, flag filesystem.FileFlag, perm fs.FileMode) (filesystem.File, error)
func (DefaultFileHandler) ReadDir ¶
func (DefaultFileHandler) ReadDir(name string) ([]fs.DirEntry, error)
type FileHandler ¶
type FileHandler interface {
OpenFile(name string, flag filesystem.FileFlag, perm fs.FileMode) (filesystem.File, error)
Stat(name string) (fs.FileInfo, error)
ReadDir(name string) ([]fs.DirEntry, error)
Mkdir(name string, perm fs.FileMode) (filesystem.DirFS, error)
Readlink(name string) (string, error)
NewSocket(network socket.Network) (socket.Socket, error)
}
type FileManager ¶
type FileManager interface {
AddFileHandler(handler FileHandler)
RemoveFileHandler(handler FileHandler)
CreateFileDescriptor(file filesystem.File) int
CloseFileDescriptor(fd int) (filesystem.File, error)
GetFile(fd int) (filesystem.File, error)
DupFile(fd int) (int, error)
Dup2File(oldfd, newfd int) error
GetFS() filesystem.FS
OpenFile(name string, flag filesystem.FileFlag, perm fs.FileMode) (filesystem.File, error)
Stat(name string) (fs.FileInfo, error)
ReadDir(name string) ([]fs.DirEntry, error)
Mkdir(name string, perm fs.FileMode) (filesystem.DirFS, error)
Readlink(name string) (string, error)
NewSocket(network socket.Network) (socket.Socket, error)
}
type HookManger ¶
type HookManger interface {
AddHook(typ emulator.HookType, callback any, data any, begin, end uint64) (HookHandler, error)
AddControl(callback ControlCallback, data any) (ControlHandler, error)
}
type HookResult ¶
type HookResult int
const ( HookResult_Done HookResult = -1 HookResult_Next HookResult = 0 )
type InterruptCallback ¶
type InterruptCallback = func(ctx Context, intno uint64, data any) HookResult
type InterruptException ¶
type InterruptException struct {
// contains filtered or unexported fields
}
func (*InterruptException) Error ¶
func (e *InterruptException) Error() string
func (*InterruptException) Number ¶
func (e *InterruptException) Number() uint64
type InvalidCallback ¶
type InvalidCallback = func(ctx Context, data any) HookResult
type InvalidInstructionException ¶
type InvalidInstructionException struct {
// contains filtered or unexported fields
}
func (*InvalidInstructionException) Context ¶
func (e *InvalidInstructionException) Context() Context
func (*InvalidInstructionException) Error ¶
func (e *InvalidInstructionException) Error() string
type InvalidMemoryException ¶
type InvalidMemoryException struct {
// contains filtered or unexported fields
}
func (*InvalidMemoryException) Address ¶
func (e *InvalidMemoryException) Address() uint64
func (*InvalidMemoryException) Error ¶
func (e *InvalidMemoryException) Error() string
func (*InvalidMemoryException) Size ¶
func (e *InvalidMemoryException) Size() uint64
func (*InvalidMemoryException) Type ¶
func (e *InvalidMemoryException) Type() emulator.HookType
func (*InvalidMemoryException) Value ¶
func (e *InvalidMemoryException) Value() uint64
type MemoryCallback ¶
type MemoryContext ¶
type MemoryManager ¶
type MemoryManager interface {
MemMap(addr, size uint64, prot emulator.MemProt) (emulator.MemRegion, error)
MemUnmap(addr uint64, size uint64) error
MemProtect(addr, size uint64, prot emulator.MemProt) error
MapAlloc(size uint64, prot emulator.MemProt) (emulator.MemRegion, error)
MapFree(addr uint64, size uint64) error
MemAlloc(size uint64) (uint64, error)
MemFree(addr uint64) error
MemSize(addr uint64) uint64
ToPointer(addr uint64) emulator.Pointer
MemImport(val any) ([]uint64, error)
MemWrite(addr uint64, val any) ([]uint64, error)
MemExtract(addr uint64, val any) error
MemBind(p unsafe.Pointer, size uint64) (uint64, error)
MemUnbind(addr uint64) error
}
type Module ¶
type ModuleManager ¶
type PanicException ¶
type PanicException struct {
// contains filtered or unexported fields
}
func (*PanicException) Error ¶
func (e *PanicException) Error() string
func (*PanicException) Panic ¶
func (e *PanicException) Panic() any
type RegisterContext ¶
type SimulateException ¶
func NewInterruptException ¶
func NewInterruptException(ctx Context, intno uint64) SimulateException
func NewInvalidInstructionException ¶
func NewInvalidInstructionException(ctx Context) SimulateException
func NewInvalidMemoryException ¶
func NewInvalidMemoryException(ctx Context, typ emulator.HookType, addr, size, value uint64) SimulateException
func NewPanicException ¶
func NewPanicException(ctx Context, v any, stack []byte) SimulateException
type StorageContext ¶
type SymbolIter ¶
type TaskManager ¶
type TaskStatus ¶
type TaskStatus int
const ( TaskStatus_Pending TaskStatus = iota TaskStatus_Running TaskStatus_Done TaskStatus_Close )
func (TaskStatus) Error ¶
func (s TaskStatus) Error() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.