emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#42882: closed ([PATCH] system: Modify GDB skeleton to find debug fil


From: GNU bug Tracking System
Subject: bug#42882: closed ([PATCH] system: Modify GDB skeleton to find debug files for any profile.)
Date: Mon, 24 Aug 2020 13:59:02 +0000

Your message dated Mon, 24 Aug 2020 09:58:44 -0400
with message-id <87v9h86t7v.fsf@gmail.com>
and subject line Re: [bug#42882]
has caused the debbugs.gnu.org bug report #42882,
regarding [PATCH] system: Modify GDB skeleton to find debug files for any 
profile.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
42882: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=42882
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] system: Modify GDB skeleton to find debug files for any profile. Date: Sun, 16 Aug 2020 01:39:47 -0400
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




--- End Message ---
--- Begin Message --- Subject: Re: [bug#42882] Date: Mon, 24 Aug 2020 09:58:44 -0400 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
Mathieu Othacehe <othacehe@gnu.org> writes:

> Hey Maxim,
>
>> Thanks for the review!  I've taken into account your suggestions and improved
>> the mechanism a bit, so that we can now simply use the
>> GDB_DEBUG_FILE_DIRECTORY environment variable (which is set up by a new 
>> search
>> path specification defined on the gdb package). I think this is better as
>> otherwise you'd need to ensure the gcc-toolchain is installed in the profile
>> you want GDB to find the debug files (because GCC is responsible for setting
>> the LIBRARY_PATH environment variable).
>>
>> I hope it makes sense :-).
>
> I think it makes! Your last revision seems fine to me.
>
> Thanks,
>
> Mathieu

Thanks for taking a look!  I've now pushed this change into the
core-updates branch as commit 720a4adc91.

Thank you,

Maxim


--- End Message ---

reply via email to

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