You've already forked go-profiler-notes
mirror of
https://github.com/DataDog/go-profiler-notes.git
synced 2025-07-15 23:54:16 +02:00
wip
This commit is contained in:
23
examples/pclnttab/linux.go
Normal file
23
examples/pclnttab/linux.go
Normal file
@ -0,0 +1,23 @@
|
||||
//+build linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"debug/elf"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func gopclntab() ([]byte, error) {
|
||||
file, err := elf.Open(os.Args[0])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("elf.Open: %w", err)
|
||||
}
|
||||
for _, s := range file.Sections {
|
||||
if s.Name == ".gopclntab" {
|
||||
return s.Data()
|
||||
}
|
||||
}
|
||||
return nil, errors.New("could not find .gopclntab")
|
||||
}
|
Reference in New Issue
Block a user