github.com/undoio/delve@v1.9.0/pkg/proc/internal/ebpf/trace_bpfel_x86.go (about)

     1  // Code generated by bpf2go; DO NOT EDIT.
     2  //go:build (386 || amd64) && go1.16
     3  // +build 386 amd64
     4  // +build go1.16
     5  
     6  package ebpf
     7  
     8  import (
     9  	"bytes"
    10  	_ "embed"
    11  	"fmt"
    12  	"io"
    13  
    14  	"github.com/cilium/ebpf"
    15  )
    16  
    17  // loadTrace returns the embedded CollectionSpec for trace.
    18  func loadTrace() (*ebpf.CollectionSpec, error) {
    19  	reader := bytes.NewReader(_TraceBytes)
    20  	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
    21  	if err != nil {
    22  		return nil, fmt.Errorf("can't load trace: %w", err)
    23  	}
    24  
    25  	return spec, err
    26  }
    27  
    28  // loadTraceObjects loads trace and converts it into a struct.
    29  //
    30  // The following types are suitable as obj argument:
    31  //
    32  //     *traceObjects
    33  //     *tracePrograms
    34  //     *traceMaps
    35  //
    36  // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
    37  func loadTraceObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
    38  	spec, err := loadTrace()
    39  	if err != nil {
    40  		return err
    41  	}
    42  
    43  	return spec.LoadAndAssign(obj, opts)
    44  }
    45  
    46  // traceSpecs contains maps and programs before they are loaded into the kernel.
    47  //
    48  // It can be passed ebpf.CollectionSpec.Assign.
    49  type traceSpecs struct {
    50  	traceProgramSpecs
    51  	traceMapSpecs
    52  }
    53  
    54  // traceSpecs contains programs before they are loaded into the kernel.
    55  //
    56  // It can be passed ebpf.CollectionSpec.Assign.
    57  type traceProgramSpecs struct {
    58  	UprobeDlvTrace *ebpf.ProgramSpec `ebpf:"uprobe__dlv_trace"`
    59  }
    60  
    61  // traceMapSpecs contains maps before they are loaded into the kernel.
    62  //
    63  // It can be passed ebpf.CollectionSpec.Assign.
    64  type traceMapSpecs struct {
    65  	ArgMap *ebpf.MapSpec `ebpf:"arg_map"`
    66  	Events *ebpf.MapSpec `ebpf:"events"`
    67  	Heap   *ebpf.MapSpec `ebpf:"heap"`
    68  }
    69  
    70  // traceObjects contains all objects after they have been loaded into the kernel.
    71  //
    72  // It can be passed to loadTraceObjects or ebpf.CollectionSpec.LoadAndAssign.
    73  type traceObjects struct {
    74  	tracePrograms
    75  	traceMaps
    76  }
    77  
    78  func (o *traceObjects) Close() error {
    79  	return _TraceClose(
    80  		&o.tracePrograms,
    81  		&o.traceMaps,
    82  	)
    83  }
    84  
    85  // traceMaps contains all maps after they have been loaded into the kernel.
    86  //
    87  // It can be passed to loadTraceObjects or ebpf.CollectionSpec.LoadAndAssign.
    88  type traceMaps struct {
    89  	ArgMap *ebpf.Map `ebpf:"arg_map"`
    90  	Events *ebpf.Map `ebpf:"events"`
    91  	Heap   *ebpf.Map `ebpf:"heap"`
    92  }
    93  
    94  func (m *traceMaps) Close() error {
    95  	return _TraceClose(
    96  		m.ArgMap,
    97  		m.Events,
    98  		m.Heap,
    99  	)
   100  }
   101  
   102  // tracePrograms contains all programs after they have been loaded into the kernel.
   103  //
   104  // It can be passed to loadTraceObjects or ebpf.CollectionSpec.LoadAndAssign.
   105  type tracePrograms struct {
   106  	UprobeDlvTrace *ebpf.Program `ebpf:"uprobe__dlv_trace"`
   107  }
   108  
   109  func (p *tracePrograms) Close() error {
   110  	return _TraceClose(
   111  		p.UprobeDlvTrace,
   112  	)
   113  }
   114  
   115  func _TraceClose(closers ...io.Closer) error {
   116  	for _, closer := range closers {
   117  		if err := closer.Close(); err != nil {
   118  			return err
   119  		}
   120  	}
   121  	return nil
   122  }
   123  
   124  // Do not access this directly.
   125  //go:embed trace_bpfel_x86.o
   126  var _TraceBytes []byte