bug-guix
[Top][All Lists]
Advanced

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

Debugging information


From: Ludovic Courtès
Subject: Debugging information
Date: Thu, 04 Jul 2013 00:19:30 +0200
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

Hello,

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").

Currently this is an opt-in mechanism, hence commit 9bf62d9, which
enables it for a few packages.  I think it’d be great to make it opt-out
instead, but the downside is that it takes a lot of disk space; this is
not a problem when using the substituter, but it means that local builds
require more space, at least temporarily (the “debug” outputs can be
GC’d eventually.)  For the record, the debugging output for glibc takes
67 MiB, and that of Guile takes 25 MiB.  Hmm, maybe that’s not that much?

Anyway, here’s a sample session where GDB uses debugging info from libc
and libguile, both of which are installed in profile ‘foo’:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix package -p foo -i guile-2.0.9:debug -i guile-2.0.9 -i 
glibc:debug
The following packages will be installed:
   glibc-2.17     debug      
/nix/store/hr9rimw4zdbygxb44yddi9zkhffwfxmy-glibc-2.17-debug
   guile-2.0.9    out        
/nix/store/gbcsdddb4jc3iiraly1dhkgyj95pd3nj-guile-2.0.9
   guile-2.0.9    debug      
/nix/store/5ziwsxvcfqa1dpx893kc9r9sjmq21x1f-guile-2.0.9-debug

3 packages in profile

$ gdb 
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) set debug-file-directory foo/lib/debug
(gdb) file foo/bin/guile
Reading symbols from 
/nix/store/gbcsdddb4jc3iiraly1dhkgyj95pd3nj-guile-2.0.9/bin/guile...Reading 
symbols from 
/nix/store/5ziwsxvcfqa1dpx893kc9r9sjmq21x1f-guile-2.0.9-debug/lib/debug/nix/store/gbcsdddb4jc3iiraly1dhkgyj95pd3nj-guile-2.0.9/bin/guile.debug...done.
done.
(gdb) b strcmp
Function "strcmp" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (strcmp) pending.
(gdb) b scm_from_locale_string
Function "scm_from_locale_string" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (scm_from_locale_string) pending.
(gdb) r
Starting program: 
/nix/store/gbcsdddb4jc3iiraly1dhkgyj95pd3nj-guile-2.0.9/bin/guile 

Breakpoint 1, strcmp () at ../sysdeps/x86_64/multiarch/../strcmp.S:134
134     ../sysdeps/x86_64/multiarch/../strcmp.S: No such file or directory.
(gdb) disable 1
(gdb) c
Continuing.
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library 
"/nix/store/ybdv89csf4sn7wbmgj9kfjjk1b0mhrlb-glibc-2.17/lib/libthread_db.so.1".

Breakpoint 2, scm_from_locale_string (address@hidden "pruhsruhpwphuhuh") at 
strings.c:1583
1583    strings.c: No such file or directory.
--8<---------------cut here---------------end--------------->8---

The important thing here is ‘set debug-file-directory’, which tells GDB
where to look for separate debugging info files.

Neat, isn’t it?  :-)

I think it’s an important feature if we are to make software freedom practical.

Comments?

Ludo’.



reply via email to

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