all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#42882] [PATCH] system: Modify GDB skeleton to find debug files for any profile.
@ 2020-08-16  5:39 Maxim Cournoyer
  2020-08-16  8:21 ` Mathieu Othacehe
  2020-08-16 13:44 ` [bug#42882] [PATCH] system: Modify GDB skeleton to find debug files for any profile Maxim Cournoyer
  0 siblings, 2 replies; 7+ messages in thread
From: Maxim Cournoyer @ 2020-08-16  5:39 UTC (permalink / raw)
  To: 42882; +Cc: Maxim Cournoyer

Instead of hard coding the debug directory to that of the user profile, use
Guile scripting to derive the debug file directories from the LIBRARY_PATH
environment variable.

* gnu/system/shadow.scm (default-skeletons)[gdbinit]: Derive the value of
DEBUG-FILE-DIRECTORY via the environment variable LIBRARY_PATH, so that debug
files from any profile can be found.
* doc/guix.texi (Installing Debugging Files): Document it.
---
 doc/guix.texi         | 17 +++++++++++++++++
 gnu/system/shadow.scm | 11 ++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 587c004bee..53b85418fb 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -30145,6 +30145,23 @@ GDB}):
 From there on, GDB will pick up debugging information from the
 @file{.debug} files under @file{~/.guix-profile/lib/debug}.
 
+Below is an alternative GDB script that can be useful when working with
+other profiles.  It takes advantage of the Guile integration available
+in GDB.
+
+@example
+guile
+(begin
+  (use-modules (gdb)
+               (srfi srfi-26))
+  (let* ((library-paths (string-split (getenv "LIBRARY_PATH") #\:))
+         (debug-paths (map (cut string-append <> "/debug")
+                           library-paths)))
+    (execute (format #f "set debug-file-directory ~a"
+                     (string-join debug-paths ":")))))
+end
+@example
+
 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 of the package of interest (obtained with @code{guix build
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index a69339bc07..d31cd37077 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -162,7 +162,16 @@ XTerm*utf8: always
 XTerm*metaSendsEscape: true\n"))
         (gdbinit   (plain-file "gdbinit" "\
 # Tell GDB where to look for separate debugging files.
-set debug-file-directory ~/.guix-profile/lib/debug
+guile
+(begin
+  (use-modules (gdb)
+               (srfi srfi-26))
+  (let* ((library-paths (string-split (getenv \"LIBRARY_PATH\") #\\:))
+         (debug-paths (map (cut string-append <> \"/debug\")
+                           library-paths)))
+    (execute (format #f \"set debug-file-directory ~a\"
+                     (string-join debug-paths \":\")))))
+end
 
 # Authorize extensions found in the store, such as the
 # pretty-printers of libstdc++.
-- 
2.27.0





^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-08-24 13:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-16  5:39 [bug#42882] [PATCH] system: Modify GDB skeleton to find debug files for any profile Maxim Cournoyer
2020-08-16  8:21 ` Mathieu Othacehe
2020-08-16 19:18   ` [bug#42882] Maxim Cournoyer
2020-08-16 19:18     ` [bug#42882] [PATCH v3] system: Modify GDB skeleton to find debug files for any profile Maxim Cournoyer
2020-08-24  8:48     ` [bug#42882] Mathieu Othacehe
2020-08-24 13:58       ` bug#42882: Maxim Cournoyer
2020-08-16 13:44 ` [bug#42882] [PATCH] system: Modify GDB skeleton to find debug files for any profile Maxim Cournoyer

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.