mirror of
				https://github.com/go-delve/delve.git
				synced 2025-10-31 18:57:18 +08:00 
			
		
		
		
	 5452c30fac
			
		
	
	5452c30fac
	
	
	
		
			
			The ebpf implementations uses cgo, but only to access some C struct definitions. Instead of using cgo simply duplicate the defintion of those two structs in Go and add a test to check that the duplicate definitions remain synchronized. Fixes #2827
		
			
				
	
	
		
			45 lines
		
	
	
		
			1009 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1009 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| //go:build !linux || !amd64 || !go1.16
 | |
| // +build !linux !amd64 !go1.16
 | |
| 
 | |
| package ebpf
 | |
| 
 | |
| import (
 | |
| 	"debug/elf"
 | |
| 	"errors"
 | |
| )
 | |
| 
 | |
| type EBPFContext struct {
 | |
| }
 | |
| 
 | |
| func (ctx *EBPFContext) Close() {
 | |
| 
 | |
| }
 | |
| 
 | |
| func (ctx *EBPFContext) AttachUprobe(pid int, name string, offset uint32) error {
 | |
| 	return errors.New("eBPF is disabled")
 | |
| }
 | |
| 
 | |
| func (ctx *EBPFContext) AttachURetprobe(pid int, name string, offset uint32) error {
 | |
| 	return errors.New("eBPF is disabled")
 | |
| }
 | |
| 
 | |
| func (ctx *EBPFContext) UpdateArgMap(key uint64, goidOffset int64, args []UProbeArgMap, gAddrOffset uint64, isret bool) error {
 | |
| 	return errors.New("eBPF is disabled")
 | |
| }
 | |
| 
 | |
| func (ctx *EBPFContext) GetBufferedTracepoints() []RawUProbeParams {
 | |
| 	return nil
 | |
| }
 | |
| 
 | |
| func SymbolToOffset(file, symbol string) (uint32, error) {
 | |
| 	return 0, errors.New("eBPF disabled")
 | |
| }
 | |
| 
 | |
| func LoadEBPFTracingProgram(path string) (*EBPFContext, error) {
 | |
| 	return nil, errors.New("eBPF disabled")
 | |
| }
 | |
| 
 | |
| func AddressToOffset(f *elf.File, addr uint64) (uint32, error) {
 | |
| 	return 0, errors.New("eBPF disabled")
 | |
| }
 |