libdd-libunwind-sys 1.0.1

Rust bindings for using unwind library inside libdatadog
Documentation

libdatadog-libunwind

Rust bindings for libunwind, targeting Linux on x86_64 and aarch64.

libunwind is vendored directly in this repository under libdd-libunwind-sys/libunwind/. Vendoring is intentional: it eliminates the runtime dependency on an external source and protects against supply chain attacks.

Crates

Crate Description
libdd-libunwind-sys Low-level FFI bindings and build logic

Bindings

The FFI bindings in libdd-libunwind-sys/src/ are hand-written (not generated by bindgen). Each supported architecture has its own module:

  • libunwind_x86_64.rs — bindings for x86_64
  • libunwind_aarch64.rs — bindings for aarch64

The bindings expose a subset of the libunwind API: unw_init_local2, unw_step, unw_get_reg, unw_get_proc_name, and unw_backtrace2.

When adding or updating bindings, edit the appropriate architecture file directly.

Build

Prerequisites

The build script compiles libunwind from source and requires the following tools on the host:

Tool Purpose Install (Debian/Ubuntu)
make Drives the build apt install make
gcc or clang C/C++ compiler for libunwind apt install gcc

Install all at once:

apt install make gcc

Building

cargo build

Supported targets

Target Status
x86_64-unknown-linux-gnu Supported
aarch64-unknown-linux-gnu Supported

All other targets produce an empty crate (the build script and bindings are gated on target_os = "linux").