system: Modify GDB skeleton to find debug files for any profile.
Instead of hard coding the debug directory to that of the user profile, use Guile scripting in combination with a new search path specification on GDB to specify the debug file directories. * gnu/packages/gdb.scm (gdb-9.1): Add a search path specification for the GDB_DEBUG_FILE_DIRECTORY environment variable. * gnu/system/shadow.scm (default-skeletons)[gdbinit]: Derive the value of DEBUG-FILE-DIRECTORY via the GDB_DEBUG_FILE_DIRECTORY environment variable. * doc/guix.texi (Installing Debugging Files): Document it.master
parent
8b074a0abe
commit
720a4adc91
|
@ -29919,6 +29919,20 @@ GDB}):
|
||||||
From there on, GDB will pick up debugging information from the
|
From there on, GDB will pick up debugging information from the
|
||||||
@file{.debug} files under @file{~/.guix-profile/lib/debug}.
|
@file{.debug} files under @file{~/.guix-profile/lib/debug}.
|
||||||
|
|
||||||
|
Below is an alternative GDB script which is useful when working with
|
||||||
|
other profiles. It takes advantage of the optional Guile integration in
|
||||||
|
GDB. This snippet is included by default on Guix System in the
|
||||||
|
@file{~/.gdbinit} file.
|
||||||
|
|
||||||
|
@example
|
||||||
|
guile
|
||||||
|
(use-modules (gdb))
|
||||||
|
(execute (string-append "set debug-file-directory "
|
||||||
|
(or (getenv "GDB_DEBUG_FILE_DIRECTORY")
|
||||||
|
"~/.guix-profile/lib/debug")))
|
||||||
|
end
|
||||||
|
@end example
|
||||||
|
|
||||||
In addition, you will most likely want GDB to be able to show the source
|
In addition, you will most likely want GDB to be able to show the source
|
||||||
code being debugged. To do that, you will have to unpack the source
|
code being debugged. To do that, you will have to unpack the source
|
||||||
code of the package of interest (obtained with @code{guix build
|
code of the package of interest (obtained with @code{guix build
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
||||||
;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
|
;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
|
||||||
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -117,6 +118,12 @@
|
||||||
("dejagnu" ,dejagnu)
|
("dejagnu" ,dejagnu)
|
||||||
("pkg-config" ,pkg-config)
|
("pkg-config" ,pkg-config)
|
||||||
,@(if (hurd-target?) `(("mig" ,mig)) '())))
|
,@(if (hurd-target?) `(("mig" ,mig)) '())))
|
||||||
|
;; TODO: Add support for the GDB_DEBUG_FILE_DIRECTORY environment variable
|
||||||
|
;; in GDB itself instead of relying on some glue code in the Guix-provided
|
||||||
|
;; .gdbinit file.
|
||||||
|
(native-search-paths (list (search-path-specification
|
||||||
|
(variable "GDB_DEBUG_FILE_DIRECTORY")
|
||||||
|
(files '("lib/debug")))))
|
||||||
(home-page "https://www.gnu.org/software/gdb/")
|
(home-page "https://www.gnu.org/software/gdb/")
|
||||||
(synopsis "The GNU debugger")
|
(synopsis "The GNU debugger")
|
||||||
(description
|
(description
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
|
;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
|
||||||
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
|
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
|
||||||
|
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -162,7 +163,12 @@ XTerm*utf8: always
|
||||||
XTerm*metaSendsEscape: true\n"))
|
XTerm*metaSendsEscape: true\n"))
|
||||||
(gdbinit (plain-file "gdbinit" "\
|
(gdbinit (plain-file "gdbinit" "\
|
||||||
# Tell GDB where to look for separate debugging files.
|
# Tell GDB where to look for separate debugging files.
|
||||||
set debug-file-directory ~/.guix-profile/lib/debug
|
guile
|
||||||
|
(use-modules (gdb))
|
||||||
|
(execute (string-append \"set debug-file-directory \"
|
||||||
|
(or (getenv \"GDB_DEBUG_FILE_DIRECTORY\")
|
||||||
|
\"~/.guix-profile/lib/debug\")))
|
||||||
|
end
|
||||||
|
|
||||||
# Authorize extensions found in the store, such as the
|
# Authorize extensions found in the store, such as the
|
||||||
# pretty-printers of libstdc++.
|
# pretty-printers of libstdc++.
|
||||||
|
|
Reference in New Issue