package main import ( "debug/elf" "fmt" "os" "github.com/go-delve/delve/pkg/dwarf/godwarf" "github.com/sirupsen/logrus" ) func main() { fpath := "/home/vbatts/bin/cosign" if len(os.Args) > 1 { fpath = os.Args[1] } f, err := elf.Open(fpath) if err != nil { logrus.Fatal(err) } defer func() { if err := f.Close(); err != nil { logrus.Warn(err) } }() buf, err := godwarf.GetDebugSectionElf(f, "abbrev") if err != nil { logrus.Fatal(err) } fmt.Println(buf) libs, err := f.ImportedLibraries() if err != nil { logrus.Fatal(err) } fmt.Printf("Libraries:\n%#v\n", libs) func() { syms, err := f.ImportedSymbols() if err != nil { logrus.Warn(err) } else { fmt.Printf("ImportedSymbols:\n%#v\n", syms) } }() syms, err := f.DynamicSymbols() if err != nil { logrus.Warn(err) } else { fmt.Printf("DynamicSymbols:\n%#v\n", syms) } syms, err = f.Symbols() if err != nil { logrus.Warn(err) } else { fmt.Printf("Symbols:\n%#v\n", syms) } d, err := f.DWARF() if err != nil { logrus.Fatal(err) } _ = d }