instrument

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TrampolineJumpIfDesc                 = "/* TRAMPOLINE_JUMP_IF */"
	TrampolineJumpIfDescRegexp           = "/\\* TRAMPOLINE_JUMP_IF \\*/"
	TrampolineNoNewlinePlaceholder       = "/* NO_NEWWLINE_PLACEHOLDER */"
	TrampolineNoNewlinePlaceholderRegexp = "/\\* NO_NEWWLINE_PLACEHOLDER \\*/\n"
	TrampolineSemicolonPlaceholder       = "/* SEMICOLON_PLACEHOLDER */"
	TrampolineSemicolonPlaceholderRegexp = "/\\* SEMICOLON_PLACEHOLDER \\*/\n"
)
View Source
const (
	OtelAPIFile        = "otel_api.go"
	OtelTrampolineFile = "otel_trampoline.go"
)
View Source
const (
	TrampolineSetParamName           = "SetParam"
	TrampolineGetParamName           = "GetParam"
	TrampolineSetReturnValName       = "SetReturnVal"
	TrampolineGetReturnValName       = "GetReturnVal"
	TrampolineValIdentifier          = "val"
	TrampolineCtxIdentifier          = "c"
	TrampolineParamsIdentifier       = "Params"
	TrampolineReturnValsIdentifier   = "ReturnVals"
	TrampolineSkipName               = "skip"
	TrampolineCallContextName        = "callContext"
	TrampolineCallContextType        = "CallContext"
	TrampolineCallContextImplType    = "CallContextImpl"
	TrampolineOnEnterName            = "OtelOnEnterTrampoline"
	TrampolineOnExitName             = "OtelOnExitTrampoline"
	TrampolineOnEnterNamePlaceholder = "\"OtelOnEnterNamePlaceholder\""
	TrampolineOnExitNamePlaceholder  = "\"OtelOnExitNamePlaceholder\""
)

----------------------------------------------------------------------------- Trampoline Jump

We distinguish between three types of functions: RawFunc, TrampolineFunc, and HookFunc. RawFunc is the original function that needs to be instrumented. TrampolineFunc is the function that is generated to call the onEnter and onExit hooks, it serves as a trampoline to the original function. HookFunc is the function that is called at entrypoint and exitpoint of the RawFunc. The so-called "Trampoline Jump" snippet is inserted at start of raw func, it is guaranteed to be generated within one line to avoid confusing debugging, as its name suggests, it jumps to the trampoline function from raw function.

Variables

This section is empty.

Functions

func Instrument

func Instrument() error

Types

type ParamTrait

type ParamTrait struct {
	Index          int
	IsVaradic      bool
	IsInterfaceAny bool
}

type RuleProcessor

type RuleProcessor struct {
	// contains filtered or unexported fields
}

type TJump

type TJump struct {
	// contains filtered or unexported fields
}

TJump describes a trampoline-jump-if optimization candidate

Jump to

Keyboard shortcuts

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