cover

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCovMeta

func AddCovMeta(p unsafe.Pointer, dlen uint32, hash [16]byte, pkpath string, pkgid int, cmode uint8, cgran uint8) uint32

AddCovMeta is invoked during package "init" functions by the compiler when compiling for coverage instrumentation; here 'p' is a meta-data blob of length 'dlen' for the package in question, 'hash' is a compiler-computed md5.sum for the blob, 'pkpath' is the package path, 'pkid' is the hard-coded ID that the compiler is using for the package (or -1 if the compiler doesn't think a hard-coded ID is needed), and 'cmode'/'cgran' are the coverage counter mode and granularity requested by the user. Return value is the ID for the package for use by the package code itself.

func AppendCovCounterList

func AppendCovCounterList(res []CovCounterBlob)

func GetCovPkgMap

func GetCovPkgMap() map[int]int

Types

type CovCounterBlob

type CovCounterBlob struct {
	Counters *uint32
	Len      uint64
}

CovCounterBlob is a container for encapsulating a counter section (BSS variable) for an instrumented Go module. Here "counters" points to the counter payload and "len" is the number of uint32 entries in the section.

type CovMetaBlob

type CovMetaBlob struct {
	P                  *byte
	Len                uint32
	Hash               [16]byte
	PkgPath            string
	PkgID              int
	CounterMode        uint8 // coverage.CounterMode
	CounterGranularity uint8 // coverage.CounterGranularity
}

CovMetaBlob is a container for holding the meta-data symbol (an RODATA variable) for an instrumented Go package. Here "p" points to the symbol itself, "len" is the length of the sym in bytes, and "hash" is an md5sum for the sym computed by the compiler. When the init function for a coverage-instrumented package executes, it will make a call into the runtime which will create a covMetaBlob object for the package and chain it onto a global list.

func GetCovMetaList

func GetCovMetaList() []CovMetaBlob

Jump to

Keyboard shortcuts

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