How To Install dwarves on Fedora 34

dwarves is Debugging Information Manipulation Tools (pahole & friends)

Introduction

In this tutorial we learn how to install dwarves on Fedora 34.

What is dwarves

dwarves is a set of tools that use the debugging information inserted in ELF binaries by compilers such as GCC, used by well known debuggers such as GDB, and more recent ones such as systemtap. Utilities in the dwarves suite include pahole, that can be used to find alignment holes in structs and classes in languages such as C, C++, but not limited to these. It also extracts other information such as CPU cacheline alignment, helping pack those structures to achieve more cache hits. These tools can also be used to encode and read the BTF type information format used with the Linux kernel bpf syscall, using ‘pahole -J’ and ‘pahole -F btf’. A diff like tool, codiff can be used to compare the effects changes in source code generate on the resulting binaries. Another tool is pfunct, that can be used to find all sorts of information about functions, inlines, decisions made by the compiler about inlining, etc. One example of pfunct usage is in the fullcircle tool, a shell that drivers pfunct to generate compileable code out of a .o file and then build it using gcc, with the same compiler flags, and then use codiff to make sure the original .o file and the new one generated from debug info produces the same debug info. Pahole also can be used to use all this type information to pretty print raw data according to command line directions. Headers can have its data format described from debugging info and offsets from it can be used to further format a number of records. The btfdiff utility compares the output of pahole from BTF and DWARF to make sure they produce the same results.

We can use yum or dnf to install dwarves on Fedora 34. In this tutorial we discuss both methods but you only need to choose one of method to install dwarves.

Install dwarves on Fedora 34 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install dwarves using dnf by running the following command:

sudo dnf -y install dwarves

Install dwarves on Fedora 34 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install dwarves using yum by running the following command:

sudo yum -y install dwarves

How To Uninstall dwarves on Fedora 34

To uninstall only the dwarves package we can use the following command:

sudo dnf remove dwarves

dwarves Package Contents on Fedora 34

/usr/bin/btfdiff
/usr/bin/codiff
/usr/bin/ctracer
/usr/bin/dtagnames
/usr/bin/fullcircle
/usr/bin/ostra-cg
/usr/bin/pahole
/usr/bin/pdwtags
/usr/bin/pfunct
/usr/bin/pglobal
/usr/bin/prefcnt
/usr/bin/scncopy
/usr/bin/syscse
/usr/lib/.build-id
/usr/lib/.build-id/06
/usr/lib/.build-id/06/dbbae5c687385d228c0d687da7313e1146717f
/usr/lib/.build-id/48
/usr/lib/.build-id/48/75c19d3fcecba96b9b3a5fe6ca4bc62600cdca
/usr/lib/.build-id/53
/usr/lib/.build-id/53/00f1638d249e22248e5696bbec033b01275b95
/usr/lib/.build-id/a3
/usr/lib/.build-id/a3/32d3b6f444a92ff0f2ed20d1ba45d3d5299039
/usr/lib/.build-id/af
/usr/lib/.build-id/af/fca6f7bde3da48ca7f12d68fea6248dd574e56
/usr/lib/.build-id/d0
/usr/lib/.build-id/d0/317c987846aceb5f47f48a9ec7184fcacdb01e
/usr/lib/.build-id/d8
/usr/lib/.build-id/d8/e81de9f1ed51ef7856a194af752403b9e2366d
/usr/lib/.build-id/e3
/usr/lib/.build-id/e3/86159519792e524328043bce864b24ce0d4f22
/usr/lib/.build-id/f8
/usr/lib/.build-id/f8/545c5f3d20b91f8773f3a84c7abd29977db8b6
/usr/lib/.build-id/fe
/usr/lib/.build-id/fe/45b209e30eb276a61f47c37cfa2b3a818e7c12
/usr/share/doc/dwarves
/usr/share/doc/dwarves/NEWS
/usr/share/doc/dwarves/README.btf
/usr/share/doc/dwarves/README.ctracer
/usr/share/doc/dwarves/changes-v1.21
/usr/share/dwarves
/usr/share/dwarves/runtime
/usr/share/dwarves/runtime/Makefile
/usr/share/dwarves/runtime/ctracer_relay.c
/usr/share/dwarves/runtime/ctracer_relay.h
/usr/share/dwarves/runtime/linux.blacklist.cu
/usr/share/dwarves/runtime/python
/usr/share/dwarves/runtime/python/ostra.py
/usr/share/man/man1/pahole.1.gz
/usr/bin/btfdiff
/usr/bin/codiff
/usr/bin/ctracer
/usr/bin/dtagnames
/usr/bin/fullcircle
/usr/bin/ostra-cg
/usr/bin/pahole
/usr/bin/pdwtags
/usr/bin/pfunct
/usr/bin/pglobal
/usr/bin/prefcnt
/usr/bin/scncopy
/usr/bin/syscse
/usr/lib/.build-id
/usr/lib/.build-id/11
/usr/lib/.build-id/11/75b9072b317eabd040c6e237bb75f9c1625309
/usr/lib/.build-id/1d
/usr/lib/.build-id/1d/82fbaafc321aa96007fe42c41a8fa87440f73d
/usr/lib/.build-id/20
/usr/lib/.build-id/20/4edce792154e72532caab741355595c393684c
/usr/lib/.build-id/48
/usr/lib/.build-id/48/ff8d56e714cbca2704459e94d391af2a883d11
/usr/lib/.build-id/94
/usr/lib/.build-id/94/404204652a8a2e7717deaafc88a6573f5a18c4
/usr/lib/.build-id/cc
/usr/lib/.build-id/cc/d56b1bc9ca44e6452ebae38a347bb330d1c664
/usr/lib/.build-id/ce
/usr/lib/.build-id/ce/1ca3928e7f123ed2b08b76df0cfda88a3162ff
/usr/lib/.build-id/da
/usr/lib/.build-id/da/565f155cddad22d472417534c6f735e1e4cb05
/usr/lib/.build-id/ea
/usr/lib/.build-id/ea/15b667f3cbbf64e7390e60bbedc3cb2c2b7eac
/usr/lib/.build-id/ef
/usr/lib/.build-id/ef/4c00b8dcdae9fbd9355d076b099ec5042071b3
/usr/share/doc/dwarves
/usr/share/doc/dwarves/NEWS
/usr/share/doc/dwarves/README.btf
/usr/share/doc/dwarves/README.ctracer
/usr/share/doc/dwarves/changes-v1.20
/usr/share/dwarves
/usr/share/dwarves/runtime
/usr/share/dwarves/runtime/Makefile
/usr/share/dwarves/runtime/ctracer_relay.c
/usr/share/dwarves/runtime/ctracer_relay.h
/usr/share/dwarves/runtime/linux.blacklist.cu
/usr/share/dwarves/runtime/python
/usr/share/dwarves/runtime/python/ostra.py
/usr/share/man/man1/pahole.1.gz

References

Summary

In this tutorial we learn how to install dwarves on Fedora 34 using yum and dnf.