goexec

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package goexec provides the utilities to analyze the executable code

Package goexec helps analyzing Go executables

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindReturnOffsets

func FindReturnOffsets(baseOffset uint64, data []byte) ([]uint64, error)

Types

type FieldOffsets

type FieldOffsets map[GoOffset]any

type FuncOffsets

type FuncOffsets struct {
	Start   uint64
	Returns []uint64
}

type GoOffset

type GoOffset uint32

this const table must match what's in go_offsets.h

const (
	// go common
	ConnFdPos GoOffset = iota + 1 // start at 1, must match what's in go_offsets.h
	FdLaddrPos
	FdRaddrPos
	TCPAddrPortPtrPos
	TCPAddrIPPtrPos
	// http
	URLPtrPos
	PathPtrPos
	HostPtrPos
	SchemePtrPos
	MethodPtrPos
	StatusCodePtrPos
	ResponseLengthPtrPos
	ContentLengthPtrPos
	ReqHeaderPtrPos
	IoWriterBufPtrPos
	IoWriterNPos
	CcNextStreamIDPos
	CcNextStreamIDVendoredPos
	CcFramerPos
	CcFramerVendoredPos
	FramerWPos
	PcConnPos
	PcTLSPos
	NetConnPos
	CcTconnPos
	CcTconnVendoredPos
	ScConnPos
	CRwcPos
	CTlsPos
	// grpc
	GrpcStreamStPtrPos
	GrpcStreamMethodPtrPos
	GrpcStatusSPos
	GrpcStatusCodePtrPos
	MetaHeadersFrameFieldsPtrPos
	ValueContextValPtrPos
	GrpcStConnPos
	GrpcTConnPos
	GrpcTSchemePos
	GrpcTransportStreamIDPos
	GrpcTransportBufWriterBufPos
	GrpcTransportBufWriterOffsetPos
	GrpcTransportBufWriterConnPos
	// redis
	RedisConnBwPos
	// kafka go
	KafkaGoWriterTopicPos
	KafkaGoProtocolConnPos
	KafkaGoReaderTopicPos
	// kafka sarama
	SaramaBrokerCorrIDPos
	SaramaResponseCorrIDPos
	SaramaBrokerConnPos
	SaramaBufconnConnPos
	// grpc versioning
	GrpcOneSixZero
	GrpcOneSixNine
	GrpcOneSevenSeven
	// HTTP2 versioning
	HTTP2ZeroFortyFive
	// grpc 1.69
	GrpcServerStreamStream
	GrpcServerStreamStPtr
	GrpcClientStreamStream
	// go manual spans
	GoTracerDelegatePos
	GoTracerAttributeOptOffset
	GoErrorStringOffset
	// go jsonrpc
	GoJsonrpcRequestHeaderServiceMethodPos
	// go mongodb
	MongoConnNamePos
	MongoOpNamePos
	MongoOpDBPos
	MongoOneThirteenOne
	// database/sql stdlib
	DriverConnCiPos
	// mysql driver
	MySQLConnCfgPos
	MySQLConfigAddrPos
	MySQLConnTypeOffset
	// route harvesting offsets
	MuxTemplatePos
	GinFullpathPos
)

type Offsets

type Offsets struct {
	// Funcs key: function name
	Funcs  map[string]FuncOffsets
	Field  FieldOffsets
	ITypes map[string]uint64
}

func InspectOffsets

func InspectOffsets(execElf *exec.FileInfo, funcs []string) (*Offsets, error)

InspectOffsets gets the memory addresses/offsets of the instrumenting function, as well as the required parameters fields to be read from the eBPF code

Jump to

Keyboard shortcuts

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