Documentation
¶
Overview ¶
YOU HAVE BEEN WARNED!
Index ¶
- func AllFunctions() (functions map[string]bool, err error)
- func CreateFuncForCodePtr(outFuncPtr interface{}, codePtr uintptr) (*hack.Func, error)
- func ExposeFunction(funcSymName string, templateFunc interface{}) (function interface{}, err error)
- func FindFuncByName(name string) (uintptr, error)
- func FindVarByName(name string) (uintptr, error)
- func GetFunctionSymbol(function interface{}) (symbol *gosym.Func, err error)
- func GetSymbolTable() (*gosym.Table, error)
- func NewFuncWithCodePtr(typ reflect.Type, codePtr uintptr) reflect.Value
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllFunctions ¶
AllFunctions returns the name of every function that has been compiled into the current binary. Use it as a debug helper to see if a function has been compiled in or not.
func CreateFuncForCodePtr ¶
CreateFuncForCodePtr is given a code pointer and creates a function value that uses that pointer. The outFun argument should be a pointer to a function of the proper type (e.g. the address of a local variable), and will be set to the result function value.
func ExposeFunction ¶
ExposeFunction exposes a function or method, allowing you to bypass export restrictions. It looks for the symbol specified by funcSymName and returns a function with its implementation, or nil if the symbol wasn't found.
funcSymName must be the exact symbol name from the binary. Use AllFunctions() to find it. If your program doesn't have any references to a function, it will be omitted from the binary during compilation. You can prevent this by saving a reference to it somewhere, or calling a function that indirectly references it.
templateFunc MUST have the correct function type, or else undefined behavior will result!
Example:
exposed := ExposeFunction("reflect.methodName", (func() string)(nil))
if exposed != nil {
f := exposed.(func() string)
fmt.Printf("Result of reflect.methodName: %v\n", f())
}
func FindFuncByName ¶
FindFuncByName read the symbol table at runtime
func FindVarByName ¶
FindVarByName read the var address at runtime
func GetFunctionSymbol ¶
GetFunctionSymbol returns the symbols for a given function.
func GetSymbolTable ¶
GetSymbolTable loads (if necessary) and returns the symbol table for this process
