[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debugging information

From: Ludovic Courtès
Subject: Re: Debugging information
Date: Tue, 09 Jul 2013 00:28:07 +0200
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

address@hidden (Ludovic Courtès) skribis:

> Commit be58d01 in ‘core-updates’ changes ‘gnu-build-system’ such that,
> if a package has a derivation output called “debug”, the ‘strip’ phase
> saves debugging info in separate files there, instead of just losing it
> (info "(gdb) Separate Debug Files").

Commit 91ef73d adds documentation for this, copied below.
While at it, I also documented multiple-output packages.

Comments welcome!


6.2 Installing Debugging Files

Program binaries, as produced by the GCC compilers for instance, are
typically written in the ELF format, with a section containing
"debugging information".  Debugging information is what allows the
debugger, GDB, to map binary code to source code; it is required to
debug a compiled program in good conditions.

   The problem with debugging information is that is takes up a fair
amount of disk space.  For example, debugging information for the GNU C
Library weighs in at more than 60 MiB. Thus, as a user, keeping all the
debugging info of all the installed programs is usually not an option.
Yet, space savings should not come at the cost of an impediment to
debugging—especially in the GNU system, which should make it easier for
users to exert their computing freedom (*note GNU Distribution::).

   Thankfully, the GNU Binary Utilities (Binutils) and GDB provide a
mechanism that allows users to get the best of both worlds: debugging
information can be stripped from the binaries and stored in separate
files.  GDB is then able to load debugging information from those files,
when they are available (*note (gdb)Separate Debug Files::).

   The GNU distribution takes advantage of this by storing debugging
information in the ‘lib/debug’ sub-directory of a separate package
output unimaginatively called ‘debug’ (*note Packages with Multiple
Outputs::).  Users can choose to install the ‘debug’ output of a package
when they need it.  For instance, the following command installs the
debugging information for the GNU C Library and for GNU Guile:

     guix package -i glibc:debug -i guile:debug

   GDB must then be told to look for debug files in the user’s profile,
by setting the ‘debug-file-directory’ variable (consider setting it from
the ‘~/.gdbinit’ file, *note (gdb)Startup::):

     (gdb) set debug-file-directory ~/.guix-profile/lib/debug

   From there on, GDB will pick up debugging information from the
‘.debug’ files under ‘~/.guix-profile/lib/debug’.

   The ‘debug’ output mechanism in Guix is implemented by the
‘gnu-build-system’ (*note Defining Packages::).  Currently, it is
opt-in—debugging information is available only for those packages whose
definition explicitly declares a ‘debug’ output.  This may be changed to
opt-out in the future, if our build farm servers can handle the load.
To check whether a package has a ‘debug’ output, use ‘guix package
--list-available’ (*note Invoking guix package::).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]