From Gentoo Wiki
Jump to: navigation, search
This article is a stub. You can help Gentoo Wiki by expanding it.

Install debugging information and sources for selected packages

To install debugging information you can use the splitdebug feature (or alternatively the nostrip feature) and to install the source code you need the installsources feature which in turn requires the dev-util/debugedit. These features are integrated so they provide you with an environment where sys-devel/gdb can find both the debugging information and the sources and lets you fully use its interactive debugging features.

CFLAGS="${CFLAGS} -ggdb"
                                    FEATURES="${FEATURES} splitdebug installsources"
category/your-package debug
root #emerge --ask dev-util/debugedit sys-devel/gdb
root #emerge --ask --oneshot category/your-package


You often need to have gcc debug information in order to run valgrind on any binary at all.

FILE /etc/portage/package.env
sys-libs/glibc debug

It is possible that valgrind refuses to launch with an error containing the following.

valgrind:  A must-be-redirected function
                            valgrind:  whose name matches the pattern:      strlen
                            valgrind:  in an object with soname matching:

In this case, you need to[1]:

Create a copy of the glibc ebuild in a local overlay, then edit the file sys-libs/glibc/files/eblits/common.eblit, line 226 :

FILE /path/to/overlay/.../sys-libs/glibc/files/eblits/common.eblit
append-flags -O2 -fno-strict-aliasing
and add
at the end of the line.

Also, aactivate the nostrip feature:

FILE /etc/portage/make.conf
root #emerge --ask --oneshot sys-libs/glibc
You can remove or comment out the FEATURES line after glibc is merged.
  1. Jump up