Skip to content

nsrip-dd/cgotraceback

Repository files navigation

cgotraceback enables collecting call stacks in C code and mapping C code instruction addresses to file & function names. This package implements the callbacks specified by runtime.SetCgoTraceback. To use the package, underscore import it anywhere in your program:

import _ "github.com/nsrip-dd/cgotraceback"

By default, dladdr will be used to symbolize instruction addresses. This will give function names and the files (i.e. shared libraries or executable) the functions are in, but will not have source file names or line numbers.

On Linux, instructions from programs/libraries compiled with DWARF debugging information can be mapped to function names, files, and line numbers using libdwfl from elfutils. The library is available on most package managers:

  • Alpine: apk add elfutils-dev
  • Debian/Ubuntu: apt install libdw-dev
  • CentOS: yum install elfutils-libs

To use libdwfl, provide the use_libdwfl build tag:

$ go build -tags=use_libdwfl

About

Yet another C/Go call stack unwinding library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published