instrumentation

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

* Copyright 2022 ByteDance Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2022 ByteDance Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddedImportToTrc

func AddedImportToTrc(w io.Writer, filepath string, srcImports, tarImports []*Import) (map[string]struct{}, error)

func Concatenate

func Concatenate(src, trc string, tarImports []*Import) error

func GetAllFunctionInFile

func GetAllFunctionInFile(options atgconstant.Options) ([]string, error)

func GetOriginExprV2

func GetOriginExprV2(c *CoverFile, node ast.Node) []byte

func ModifySrcBasedTarget

func ModifySrcBasedTarget(w io.Writer, filepath string, targetFunction map[string]struct{}) error

func NewFunctionBuilder

func NewFunctionBuilder(ctx context.Context) *functionBuilder

func NewInstrumentation

func NewInstrumentation(file string, funcName, id string) ([]byte, int, error)

Types

type Branch

type Branch struct {
}

type CoverFile

type CoverFile struct {
	RepeatedName bool
	Uid          string
	Pkg          string
	// contains filtered or unexported fields
}

func (*CoverFile) Rename

func (c *CoverFile) Rename()

func (*CoverFile) Visit

func (c *CoverFile) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface. If the developer doesn't know how to write the code, please refer to

type File

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

File is a wrapper for the state of a file used in the parser. The basic parse tree walker is a method of this type.

type Func

type Func struct {
	Name string
	// contains filtered or unexported fields
}

type Import

type Import struct {
	Name, Path string
}

func GetImportsInfosFromFile

func GetImportsInfosFromFile(filepath string) ([]*Import, error)

type SrcFileModify

type SrcFileModify struct {
	TargetFunctions map[string]struct{}
	// contains filtered or unexported fields
}

func (*SrcFileModify) Visit

func (f *SrcFileModify) Visit(node ast.Node) ast.Visitor

type SrcFileRecord

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

func (*SrcFileRecord) Visit

func (f *SrcFileRecord) Visit(node ast.Node) ast.Visitor

type TestedFunctionInfo

type TestedFunctionInfo struct {
	PredicatesPos []int
	FunctionNames []string
}

type TrcFile

type TrcFile struct {
	TrcImports []*Import // trc file import

	FunctionNames map[string]struct{}
	// contains filtered or unexported fields
}

func (*TrcFile) Visit

func (f *TrcFile) Visit(node ast.Node) ast.Visitor

Jump to

Keyboard shortcuts

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