Skip to content

pwndbg/debuginfod-zig

Repository files navigation

debuginfod-zig

debuginfod-zig is a lightweight, portable alternative to GNU's debuginfod, compatible with GNU debuginfod version 0.194.

Why?

While GNU debuginfod works well only on Linux, it comes with several limitations that make it less practical in other environments or for static builds.

Problem with GNU debuginfod How debuginfod-zig solves it
No static builds – cannot be compiled statically. Supports static builds – fully self-contained binary.
Heavy dependency chain – depends on libcurl, sqlite, libelf, and many others. No external dependencies – written in pure Zig, minimal footprint.
Linux-only – cannot be built or used on macOS. Cross-platform – works on Linux and macOS.
Broken source path handling – only supports absolute paths (/path/to/file.c). Flexible source resolution – supports both relative (./build/../file.c) and absolute paths.
Written in C – complex dependency management and less safe by design. Implemented in Zig – safer, simpler, and easier to maintain.

Build

zig build -Dtarget=x86_64-linux-gnu -Doptimize=ReleaseSafe
zig build -Dtarget=aarch64-linux-gnu -Doptimize=ReleaseSafe

zig build -Dtarget=x86_64-macos -Doptimize=ReleaseSafe
zig build -Dtarget=aarch64-macos -Doptimize=ReleaseSafe

How to replace GDB debuginfod with this repo?

nix build github:pwndbg/debuginfod-zig#dynamic
cp ./result/lib/libdebuginfo.so /usr/lib64/libdebuginfod.so.1

# OR use env `LD_PRELOAD`
LD_PRELOAD=./result/lib/libdebuginfo.so /usr/bin/gdb

NOTE1: /usr/lib64/libdebuginfod.so.1 path depends on your distribution

ENV's implemented:

  • DEBUGINFOD_URLS
  • DEBUGINFOD_CACHE_PATH
  • DEBUGINFOD_MAXTIME
  • DEBUGINFOD_MAXSIZE
  • DEBUGINFOD_VERBOSE
  • DEBUGINFOD_PROGRESS
  • DEBUGINFOD_HEADERS_FILE
  • DEBUGINFOD_TIMEOUT

ENV's not-implemented:

  • DEBUGINFOD_IMA_CERT_PATH (hard?)
  • DEBUGINFOD_RETRY_LIMIT

What is missing:

  • missing func debuginfod_find_metadata
  • auto-cleanup old debuginfo files
  • ima policies/verification
  • caching headers as file /hdr-debuginfo

About

libdebuginfod rewritten in Zig - a drop-in replacement for GNU's libdebuginfod

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •