Skip to content

mkacmar/debuginfod

Repository files navigation

debuginfod

A Go client library for debuginfod servers.

See API documentation for details.

Installation

go get go.kacmar.sk/debuginfod

Usage

client, err := debuginfod.NewClient(debuginfod.Options{
    ServerURLs: []string{"https://debuginfod.elfutils.org"},
})

rc, err := client.FetchDebugInfo(ctx, buildID)
defer rc.Close()

Caching

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,
})

Retry configuration

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),
    },
})

Other endpoints

rc, err := client.FetchExecutable(ctx, buildID)
rc, err := client.FetchSource(ctx, buildID, "/usr/src/main.c")
rc, err := client.FetchSection(ctx, buildID, ".text")

Logging

client, err := debuginfod.NewClient(debuginfod.Options{
    ServerURLs: []string{"https://debuginfod.elfutils.org"},
    Logger:     slog.Default(),
})

License

MIT License - see LICENSE for details.

About

A Go client library for debuginfod servers

Resources

License

Stars

Watchers

Forks

Contributors