github.com/cnboonhan/delve@v0.0.0-20230908061759-363f2388c2fb/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  }
    68  
    69  // traceObjects contains all objects after they have been loaded into the kernel.
    70  //
    71  // It can be passed to loadTraceObjects or ebpf.CollectionSpec.LoadAndAssign.
    72  type traceObjects struct {
    73  	tracePrograms
    74  	traceMaps
    75  }
    76  
    77  func (o *traceObjects) Close() error {
    78  	return _TraceClose(
    79  		&o.tracePrograms,
    80  		&o.traceMaps,
    81  	)
    82  }
    83  
    84  // traceMaps contains all maps after they have been loaded into the kernel.
    85  //
    86  // It can be passed to loadTraceObjects or ebpf.CollectionSpec.LoadAndAssign.
    87  type traceMaps struct {
    88  	ArgMap *ebpf.Map `ebpf:"arg_map"`
    89  	Events *ebpf.Map `ebpf:"events"`
    90  }
    91  
    92  func (m *traceMaps) Close() error {
    93  	return _TraceClose(
    94  		m.ArgMap,
    95  		m.Events,
    96  	)
    97  }
    98  
    99  // tracePrograms contains all programs after they have been loaded into the kernel.
   100  //
   101  // It can be passed to loadTraceObjects or ebpf.CollectionSpec.LoadAndAssign.
   102  type tracePrograms struct {
   103  	UprobeDlvTrace *ebpf.Program `ebpf:"uprobe__dlv_trace"`
   104  }
   105  
   106  func (p *tracePrograms) Close() error {
   107  	return _TraceClose(
   108  		p.UprobeDlvTrace,
   109  	)
   110  }
   111  
   112  func _TraceClose(closers ...io.Closer) error {
   113  	for _, closer := range closers {
   114  		if err := closer.Close(); err != nil {
   115  			return err
   116  		}
   117  	}
   118  	return nil
   119  }
   120  
   121  // Do not access this directly.
   122  //go:embed trace_bpfel_x86.o
   123  var _TraceBytes []byte