testutil

package
v0.0.0-...-522126a Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package testutil provides common assembly stubs for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckTestRegs

func CheckTestRegs(regs *syscall.PtraceRegs, full bool) (err error)

CheckTestRegs checks that registers were twiddled per TwiddleRegs.

func CheckTestSegments

func CheckTestSegments(regs *syscall.PtraceRegs) (err error)

CheckTestSegments checks that registers were twiddled per TwiddleSegments.

func FloatingPointWorks

func FloatingPointWorks() bool

FloatingPointWorks is a floating point test.

It returns true or false.

func Getpid

func Getpid()

Getpid executes a trivial system call.

func HaltLoop

func HaltLoop()

HaltLoop immediately halts and loops.

func RewindSyscall

func RewindSyscall(regs *syscall.PtraceRegs)

RewindSyscall rewinds a syscall RIP.

func SetTestRegs

func SetTestRegs(regs *syscall.PtraceRegs)

SetTestRegs initializes registers to known values.

func SetTestSegments

func SetTestSegments(regs *syscall.PtraceRegs)

SetTestSegments initializes segments to known values.

func SetTestTarget

func SetTestTarget(regs *syscall.PtraceRegs, fn func())

SetTestTarget sets the rip appropriately.

func SetTouchTarget

func SetTouchTarget(regs *syscall.PtraceRegs, target *uintptr)

SetTouchTarget sets rax appropriately.

func SpinLoop

func SpinLoop()

SpinLoop spins on the CPU.

func SyscallLoop

func SyscallLoop()

SyscallLoop executes a syscall and loops.

func Touch

func Touch()

Touch touches the value in the first register.

func TwiddleRegsFault

func TwiddleRegsFault()

TwiddleRegsFault twiddles registers then faults.

func TwiddleRegsSyscall

func TwiddleRegsSyscall()

TwiddleRegsSyscall twiddles registers then executes a syscall.

func TwiddleSegments

func TwiddleSegments()

TwiddleSegments reads segments into known registers.

Types

type RegisterMismatchError

type RegisterMismatchError []string

RegisterMismatchError is used for checking registers.

func (RegisterMismatchError) Error

func (r RegisterMismatchError) Error() string

Error returns a human-readable error.

Jump to

Keyboard shortcuts

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