1
0
mirror of https://github.com/DataDog/go-profiler-notes.git synced 2025-07-12 23:50:13 +02:00
Files
Felix Geisendörfer 1f4c6f0691 wip
2021-03-30 14:51:41 +02:00

24 lines
366 B
Go

//+build darwin
package main
import (
"debug/macho"
"errors"
"fmt"
"os"
)
func gopclntab() ([]byte, error) {
file, err := macho.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")
}