A Go client library for debuginfod servers.
See API documentation for details.
go get go.kacmar.sk/debuginfodclient, err := debuginfod.NewClient(debuginfod.Options{
ServerURLs: []string{"https://debuginfod.elfutils.org"},
})
rc, err := client.FetchDebugInfo(ctx, buildID)
defer rc.Close()The library ships DiskCache, but any implementation of the Cache interface works.
cacheDir, err := debuginfod.DefaultCacheDir()
cache, err := debuginfod.NewDiskCache(debuginfod.DiskCacheOptions{
Dir: cacheDir,
})
client, err := debuginfod.NewClient(debuginfod.Options{
ServerURLs: []string{"https://debuginfod.elfutils.org"},
Cache: cache,
})client, err := debuginfod.NewClient(debuginfod.Options{
ServerURLs: []string{"https://debuginfod.elfutils.org"},
HTTP: debuginfod.HTTPOptions{
MaxAttempts: 5,
Backoff: debuginfod.ExponentialBackoff(2*time.Second, 60*time.Second),
},
})rc, err := client.FetchExecutable(ctx, buildID)
rc, err := client.FetchSource(ctx, buildID, "/usr/src/main.c")
rc, err := client.FetchSection(ctx, buildID, ".text")client, err := debuginfod.NewClient(debuginfod.Options{
ServerURLs: []string{"https://debuginfod.elfutils.org"},
Logger: slog.Default(),
})MIT License - see LICENSE for details.