Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFunctionNotFound returned when provided function was not found. ErrFunctionNotFound = fmt.Errorf("function was not found") // ErrUnsupportedArchitecture returned if cpu architecture currently unsupported. ErrUnsupportedArchitecture = fmt.Errorf("unsupported cpu architecture") // ErrShortFunction returned if function too short for trampoline. ErrShortFunction = fmt.Errorf("too short function") // ErrLongDistance returned if functions located too far for trampoline. ErrLongDistance = fmt.Errorf("long distance between functions") )
Functions ¶
This section is empty.
Types ¶
type Executable ¶
type Executable interface { io.WriterAt // GOARCH returns "GOARCH" string of executable. GOARCH() string // TextAddr returns 'text' (executable code) section address. TextAddr() uint64 // GoSymTabData returns reader for 'gosymtab' section. GoSymTabData() io.Reader // GoPCLnTabData returns reader for 'gopclntab' section. GoPCLnTabData() io.Reader // Offset returns function offset from beginning of executable. Offset(p *gosym.Func) int64 }
Executable contains methods to fetch information required for patching.
type Replacer ¶
type Replacer struct {
// contains filtered or unexported fields
}
func NewReplacer ¶
func NewReplacer(executable Executable) (*Replacer, error)
func (*Replacer) Replace ¶
Replace puts "trampoline code" to beginning of function with sourceName that redirects to function with targetName. Function names here are "raw" (no mangling, etc. performed before search). There is no checks about "cyclic replacement" (i.e. "a"->"b" than "b"->"a") so be careful to avoid infinite loops.
Click to show internal directories.
Click to hide internal directories.