Message ID | 08c09168cea2ab383bb6664682d3e8c52f70f131.1676314760.git.efraim@flashner.co.il |
---|---|
State | New |
Headers | show |
Series | [bug#61486] system: Update skeleton gdbinit. | expand |
Hi Efraim, Efraim Flashner <efraim@flashner.co.il> skribis: > * gnu/system/shadow.scm (default-skeleton): Update gdbinit to also > search for debug packages in guix-home. > (skeleton-directory): Move .gdbinit to .config/gdb/gdbinit. [...] > (use-modules (gdb)) > (execute (string-append \"set debug-file-directory \" > (or (getenv \"GDB_DEBUG_FILE_DIRECTORY\") > - \"~/.guix-profile/lib/debug\"))) > + \"~/.guix-profile/lib/debug\" > + \"~/.guix-home/profile/lib/debug\"))) This won’t have the desired effect: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (or #f "a" "b") $10 = "a" --8<---------------cut here---------------end--------------->8--- Perhaps we should check with ‘file-exists?’ which one to pick, probably giving higher precedence to ~/.guix-home/profile since Guix Home users might have both (I do). > + (when (file-exists? ".gdbinit") > + (mkdir-p ".config/gdb") > + (rename-file ".gdbinit" ".config/gdb/gdbinit")) I couldn’t believe it so I had to check the manual and yes, GDB does look for ~/.config/gdb/gdbinit! Incredible. Thanks, Ludo’.
On Mon, Feb 27, 2023 at 11:34:39PM +0100, Ludovic Courtès wrote: > Hi Efraim, > > Efraim Flashner <efraim@flashner.co.il> skribis: > > > * gnu/system/shadow.scm (default-skeleton): Update gdbinit to also > > search for debug packages in guix-home. > > (skeleton-directory): Move .gdbinit to .config/gdb/gdbinit. > > [...] > > > (use-modules (gdb)) > > (execute (string-append \"set debug-file-directory \" > > (or (getenv \"GDB_DEBUG_FILE_DIRECTORY\") > > - \"~/.guix-profile/lib/debug\"))) > > + \"~/.guix-profile/lib/debug\" > > + \"~/.guix-home/profile/lib/debug\"))) > > This won’t have the desired effect: > > --8<---------------cut here---------------start------------->8--- > scheme@(guile-user)> (or #f "a" "b") > $10 = "a" > --8<---------------cut here---------------end--------------->8--- Not the first time I've gotten that wrong :) > Perhaps we should check with ‘file-exists?’ which one to pick, probably > giving higher precedence to ~/.guix-home/profile since Guix Home users > might have both (I do). So then how about something like this? (or (getenv \"GDB_DEBUG_FILE_DIRECTORY\") (if (file-exists? \"~/.guix-home/profile/lib/debug\") \"~/.guix-home/profile/lib/debug\" \"~/.guix-profile/lib/debug\")))) Actually, I just checked the GDB manual¹ and it looks like we can add multiple paths. I'll work on it a bit and see about adding a couple more paths. > > + (when (file-exists? ".gdbinit") > > + (mkdir-p ".config/gdb") > > + (rename-file ".gdbinit" ".config/gdb/gdbinit")) > > I couldn’t believe it so I had to check the manual and yes, GDB does > look for ~/.config/gdb/gdbinit! Incredible. > > Thanks, > Ludo’. ¹ https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html
Hello! Efraim Flashner <efraim@flashner.co.il> skribis: > So then how about something like this? > > (or (getenv \"GDB_DEBUG_FILE_DIRECTORY\") > (if (file-exists? \"~/.guix-home/profile/lib/debug\") > \"~/.guix-home/profile/lib/debug\" > \"~/.guix-profile/lib/debug\")))) > > Actually, I just checked the GDB manual¹ and it looks like we can add > multiple paths. I'll work on it a bit and see about adding a couple more > paths. Oh right, we could have those two directories, colon-separated. Ludo’.
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 445a72e2f5..5802c9dfc0 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2013-2020, 2022 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> -;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> +;;; Copyright © 2020, 2023 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; ;;; This file is part of GNU Guix. @@ -169,7 +169,8 @@ (define (default-skeletons) (use-modules (gdb)) (execute (string-append \"set debug-file-directory \" (or (getenv \"GDB_DEBUG_FILE_DIRECTORY\") - \"~/.guix-profile/lib/debug\"))) + \"~/.guix-profile/lib/debug\" + \"~/.guix-home/profile/lib/debug\"))) end # Authorize extensions found in the store, such as the @@ -228,6 +229,9 @@ (define (skeleton-directory skeletons) (when (file-exists? ".nanorc") (mkdir-p ".config/nano") (rename-file ".nanorc" ".config/nano/nanorc")) + (when (file-exists? ".gdbinit") + (mkdir-p ".config/gdb") + (rename-file ".gdbinit" ".config/gdb/gdbinit")) #t)))) (define (find-duplicates list)