unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#61486] [PATCH] system: Update skeleton gdbinit.
@ 2023-02-13 19:00 Efraim Flashner
  2023-02-27 22:34 ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Efraim Flashner @ 2023-02-13 19:00 UTC (permalink / raw)
  To: 61486; +Cc: Efraim Flashner

* 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.
---
 gnu/system/shadow.scm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

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)

base-commit: dd724cfad45d76b9dcc5b073876c995715c92a07
-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted





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

* [bug#61486] [PATCH] system: Update skeleton gdbinit.
  2023-02-13 19:00 [bug#61486] [PATCH] system: Update skeleton gdbinit Efraim Flashner
@ 2023-02-27 22:34 ` Ludovic Courtès
  2023-02-28  7:53   ` Efraim Flashner
  2023-03-01  6:43   ` Efraim Flashner
  0 siblings, 2 replies; 7+ messages in thread
From: Ludovic Courtès @ 2023-02-27 22:34 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 61486

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’.




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

* [bug#61486] [PATCH] system: Update skeleton gdbinit.
  2023-02-27 22:34 ` Ludovic Courtès
@ 2023-02-28  7:53   ` Efraim Flashner
  2023-03-03 10:46     ` Ludovic Courtès
  2023-03-01  6:43   ` Efraim Flashner
  1 sibling, 1 reply; 7+ messages in thread
From: Efraim Flashner @ 2023-02-28  7:53 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 61486

[-- Attachment #1: Type: text/plain, Size: 2201 bytes --]

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

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [bug#61486] [PATCH] system: Update skeleton gdbinit.
  2023-02-27 22:34 ` Ludovic Courtès
  2023-02-28  7:53   ` Efraim Flashner
@ 2023-03-01  6:43   ` Efraim Flashner
  2023-03-03 10:46     ` Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Efraim Flashner @ 2023-03-01  6:43 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 61486


[-- Attachment #1.1: Type: text/plain, Size: 1705 bytes --]

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

Now with a new and improved version 2!

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #1.2: v2-0001-system-Update-skeleton-gdbinit.patch --]
[-- Type: text/plain, Size: 2927 bytes --]

From 721637d9afd62e70f0a4350fb38c2569fe23e80b Mon Sep 17 00:00:00 2001
Message-Id: <721637d9afd62e70f0a4350fb38c2569fe23e80b.1677652927.git.efraim@flashner.co.il>
From: Efraim Flashner <efraim@flashner.co.il>
Date: Mon, 13 Feb 2023 20:56:54 +0200
Subject: [PATCH v2] system: Update skeleton gdbinit.

* gnu/system/shadow.scm (default-skeleton): Update gdbinit to search for
more debug packages in guix-home and the system profile.
(skeleton-directory): Move .gdbinit to .config/gdb/gdbinit.
---
 gnu/system/shadow.scm | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index 445a72e2f5..2bd72d3e96 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.
@@ -168,8 +168,16 @@ (define (default-skeletons)
 guile
 (use-modules (gdb))
 (execute (string-append \"set debug-file-directory \"
-                        (or (getenv \"GDB_DEBUG_FILE_DIRECTORY\")
-                            \"~/.guix-profile/lib/debug\")))
+                        (string-join
+                          (filter file-exists?
+                                  (append
+                                    (if (getenv \"GDB_DEBUG_FILE_DIRECTORY\")
+                                      (list (getenv \"GDB_DEBUG_FILE_DIRECTORY\"))
+                                      '())
+                                    (list \"~/.guix-home/profile/lib/debug\"
+                                          \"~/.guix-profile/lib/debug\"
+                                          \"/run/current-system/profile/lib/debug\")))
+                          \":\")))
 end
 
 # Authorize extensions found in the store, such as the
@@ -228,6 +236,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)

base-commit: f9925ad9c4b30ef7fe5fdb7b3ad93e1940d40cd3
-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [bug#61486] [PATCH] system: Update skeleton gdbinit.
  2023-02-28  7:53   ` Efraim Flashner
@ 2023-03-03 10:46     ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2023-03-03 10:46 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 61486

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’.




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

* [bug#61486] [PATCH] system: Update skeleton gdbinit.
  2023-03-01  6:43   ` Efraim Flashner
@ 2023-03-03 10:46     ` Ludovic Courtès
  2023-03-07 14:35       ` bug#61486: " Efraim Flashner
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2023-03-03 10:46 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 61486

Efraim Flashner <efraim@flashner.co.il> skribis:

> From 721637d9afd62e70f0a4350fb38c2569fe23e80b Mon Sep 17 00:00:00 2001
> Message-Id: <721637d9afd62e70f0a4350fb38c2569fe23e80b.1677652927.git.efraim@flashner.co.il>
> From: Efraim Flashner <efraim@flashner.co.il>
> Date: Mon, 13 Feb 2023 20:56:54 +0200
> Subject: [PATCH v2] system: Update skeleton gdbinit.
>
> * gnu/system/shadow.scm (default-skeleton): Update gdbinit to search for
> more debug packages in guix-home and the system profile.
> (skeleton-directory): Move .gdbinit to .config/gdb/gdbinit.

LGTM, thanks!




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

* bug#61486: [PATCH] system: Update skeleton gdbinit.
  2023-03-03 10:46     ` Ludovic Courtès
@ 2023-03-07 14:35       ` Efraim Flashner
  0 siblings, 0 replies; 7+ messages in thread
From: Efraim Flashner @ 2023-03-07 14:35 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 61486-done

[-- Attachment #1: Type: text/plain, Size: 917 bytes --]

On Fri, Mar 03, 2023 at 11:46:41AM +0100, Ludovic Courtès wrote:
> Efraim Flashner <efraim@flashner.co.il> skribis:
> 
> > From 721637d9afd62e70f0a4350fb38c2569fe23e80b Mon Sep 17 00:00:00 2001
> > Message-Id: <721637d9afd62e70f0a4350fb38c2569fe23e80b.1677652927.git.efraim@flashner.co.il>
> > From: Efraim Flashner <efraim@flashner.co.il>
> > Date: Mon, 13 Feb 2023 20:56:54 +0200
> > Subject: [PATCH v2] system: Update skeleton gdbinit.
> >
> > * gnu/system/shadow.scm (default-skeleton): Update gdbinit to search for
> > more debug packages in guix-home and the system profile.
> > (skeleton-directory): Move .gdbinit to .config/gdb/gdbinit.
> 
> LGTM, thanks!

Thanks. Patch pushed!

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2023-03-07 14:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13 19:00 [bug#61486] [PATCH] system: Update skeleton gdbinit Efraim Flashner
2023-02-27 22:34 ` Ludovic Courtès
2023-02-28  7:53   ` Efraim Flashner
2023-03-03 10:46     ` Ludovic Courtès
2023-03-01  6:43   ` Efraim Flashner
2023-03-03 10:46     ` Ludovic Courtès
2023-03-07 14:35       ` bug#61486: " Efraim Flashner

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).