encodecounter

Imports

Imports #

"bufio"
"encoding/binary"
"fmt"
"internal/coverage"
"internal/coverage/slicewriter"
"internal/coverage/stringtab"
"internal/coverage/uleb128"
"io"
"maps"
"os"
"slices"

Type Aliases

CounterVisitorFn type #

CounterVisitorFn describes a callback function invoked when writing coverage counter data.

type CounterVisitorFn func(pkid uint32, funcid uint32, counters []uint32) error

Interfaces

CounterVisitor interface #

CounterVisitor describes a helper object used during counter file writing; when writing counter data files, clients pass a CounterVisitor to the write/emit routines, then the expectation is that the VisitFuncs method will then invoke the callback "f" with data for each function to emit to the file.

type CounterVisitor interface {
VisitFuncs(f CounterVisitorFn) error
}

Structs

CoverageDataWriter struct #

type CoverageDataWriter struct {
stab *stringtab.Writer
w *bufio.Writer
csh coverage.CounterSegmentHeader
tmp []byte
cflavor coverage.CounterFlavor
segs uint32
debug bool
}

Functions

AppendSegment method #

AppendSegment appends a new segment to a counter data, with a new args section followed by a payload of counter data clauses.

func (cfw *CoverageDataWriter) AppendSegment(args map[string]string, visitor CounterVisitor) error

NewCoverageDataWriter function #

func NewCoverageDataWriter(w io.Writer, flav coverage.CounterFlavor) *CoverageDataWriter

Write method #

Write writes the contents of the count-data file to the writer previously supplied to NewCoverageDataWriter. Returns an error if something went wrong somewhere with the write.

func (cfw *CoverageDataWriter) Write(metaFileHash [16]byte, args map[string]string, visitor CounterVisitor) error

padToFourByteBoundary function #

func padToFourByteBoundary(ws *slicewriter.WriteSeeker) error

patchSegmentHeader method #

func (cfw *CoverageDataWriter) patchSegmentHeader(ws *slicewriter.WriteSeeker) error

writeBytes method #

func (cfw *CoverageDataWriter) writeBytes(b []byte) error

writeCounters method #

func (cfw *CoverageDataWriter) writeCounters(visitor CounterVisitor, ws *slicewriter.WriteSeeker) error

writeFooter method #

func (cfw *CoverageDataWriter) writeFooter() error

writeHeader method #

func (cfw *CoverageDataWriter) writeHeader(metaFileHash [16]byte) error

writeSegmentPreamble method #

func (cfw *CoverageDataWriter) writeSegmentPreamble(args map[string]string, ws *slicewriter.WriteSeeker) error

Generated with Arrow