[PATCH] gnu: Add avr-gdb.

  • Done
  • quality assurance status badge
Details
3 participants
  • Thiago Jung Bauermann
  • Kristian Lein-Mathisen
  • Christopher Baines
Owner
unassigned
Submitted by
Kristian Lein-Mathisen
Severity
normal
K
K
Kristian Lein-Mathisen wrote on 2 Nov 2022 20:49
(address . guix-patches@gnu.org)
CAAGQtHyvBin9fJmoBoej7KbFhAQ-MQgA4sFZk=at9WQjNFCU0w@mail.gmail.com
I'd like to have avr-gdb available in GNU Guix.
I've used the Arch Linux PKGFILE as basis:


I'm hoping this'll be considered for inclusion upstream.

Thanks,
K.
Attachment: file
From daa7559c6c1fb23ab11bdbeb2d81f751a5cc2400 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen <kristianlein@gmail.com>
Date: Wed, 2 Nov 2022 20:36:51 +0100
Subject: [PATCH] gnu: Add avr-gdb.

* gnu/packages/gdb.scm (avr-gdb): New variable.
---
gnu/packages/gdb.scm | 12 ++++++++++++
1 file changed, 12 insertions(+)

Toggle diff (24 lines)
diff --git a/gnu/packages/gdb.scm b/gnu/packages/gdb.scm
index 7d8416c7c5..e09f7cf41a 100644
--- a/gnu/packages/gdb.scm
+++ b/gnu/packages/gdb.scm
@@ -171,3 +171,15 @@ (define-public gdb-minimal
(name "gdb-minimal")
(inputs (fold alist-delete (package-inputs gdb)
'("libxml2" "ncurses" "python-wrapper" "source-highlight")))))
+
+(define-public avr-gdb
+ (package/inherit gdb-12
+ (name "avr-gdb")
+ (arguments
+ `(#:configure-flags
+ (list "--target=avr"
+ "--disable-nls"
+ "--enable-languages=c,c++"
+ "--with-system-readline"
+ "--enable-source-highlight")
+ ,@(package-arguments gdb-12)))))

base-commit: 807bfe55dc382b88ab0fdade6886dfa2b15487ee
--
2.38.0
C
C
Christopher Baines wrote on 3 Nov 2022 18:31
(name . Kristian Lein-Mathisen)(address . kristianlein@gmail.com)
87pme4kkke.fsf@cbaines.net
Kristian Lein-Mathisen <kristianlein@gmail.com> writes:

Toggle quote (5 lines)
> I'd like to have avr-gdb available in GNU Guix.
> I've used the Arch Linux PKGFILE as basis:
>
> https://github.com/archlinux/svntogit-community/blob/fa92f7b2008ec/trunk/PKGBUILD

Hi Kristian,

This seems OK to me, although I don't know what this package is for?

Given this is inheriting from gdb, it'll have the same synopiss and
description:

synopsis: The GNU debugger
description: GDB is the GNU debugger. With it, you can monitor what a program
+ is doing while it runs or what it was doing just before a crash. It allows
+ you to specify the runtime conditions, to define breakpoints, and to change
+ how the program is running to try to fix bugs. It can be used to debug
+ programs written in C, C++, Ada, Objective-C, Pascal and more.

So, I think if there is something different about this avr-gdb, it would
be good to specify a appropriate synopsis and description. Does that
make sense?

Thanks,

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmNj++FfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xdnbg//Zq9JQIrMhL9mjMt9wRhT+Ir/oTVIMD3X
Ob9YxBrJRRk3EDSQSqlHyn/vKqtZL5OPfG7bRURRotC2bdshVemj+cRdFMxqNrai
VPW0vDt7NcqS9cI52k8QiReXtRlF77dCIp5h5PCiTaOBgr6UWFDQY9v+IRjyNNM6
Q9ZdQO+Rl+SSQlE8uqDvkWrFwDRQ+SrbnkwmTtyWDfCgndY/knLIlkqGIJ8CLheT
tkpnKPkDZ5BiV/PZdm2Uq5wPLcpnY12tKTtDHw2jRBWEiovoLLWIAktTDfHjXeSm
rvVzwZ2lCBXN9l9HybLLvG9FBO8hqKxpukfhOdZ0HtJ0rOkS7NHfA00+B24NS7uR
zRaVMhp611d3/RRaNx82cZgv5BzBxc70/FKBWcimel1ZET85UTN9n5bpUYc3oBq8
aEmP6p4/duZe2s9Hl7jbZLDG9abvJmyROkAXy+Uckcj9uiKmp9ze1d0pnI2c1rPh
c5NUwGzUVWG0yi5dA4b2o9yLCVcUa13FR85W35jaEg6sQggkOprs5VAsjHgY1xBS
ghYnfBEmE+I4t742KwxZsLe/6HXZ+dFzif5+ZO89KlhI0uOlJtZkXyWJ7jDbKwHd
kkadfOTiZQlWPnW2RWRVxDSNnMMaVdPeCQCzrdUdf874O1Mq+4drIjXWjNC4xK8m
itAzjgdATG8=
=sgOl
-----END PGP SIGNATURE-----

C
C
Christopher Baines wrote on 3 Nov 2022 19:05
tag 58971 moreinfo
(address . control@debbugs.gnu.org)
87edujoqw2.fsf@cbaines.net
tags 58971 + moreinfo
quit
K
K
Kristian Lein-Mathisen wrote on 3 Nov 2022 19:24
Re: [bug#58971] [PATCH] gnu: Add avr-gdb.
(name . Christopher Baines)(address . mail@cbaines.net)
CAAGQtHz7kPXufua4atYTJXr2aQQOht-=kMRvSpLesYYG=i0d6Q@mail.gmail.com
Hi Chris and thanks for looking into this,

Your proposal is very reasonable. I wasn't sure what to write but I've
given it a try in this replacement commit.

To be honest, I don't know why the AVR target isn't supported in the
standard GDB
build and I haven't been able to figure out how to list all supported
targets. I'm new to GDB in general so
I don't know if I'm the right person to do this writeup.

However, I'm looking at https://github.com/dwtk/dwtk(which I also intend
to package for Guix if it's of interest),
and the standard gdb gives me a bunch of error messages when I connect to
dwtk's remote gdbserver. I'm guessing this
incompatibility applies to all gdbservers implemented for AVR chips. I
haven't found much clarity of this in the GDB docs.
I presume this is the reason most distros package avr-gdb separately from
gdb like we're doing here.

I've taken the "synopsis" from Arch Linux
removed unsupported languages from the description, and just
mentioned that this is for the specific AVR microcontroller architecture.
Please let me know if that's good enough.

Thanks,
K.

On Thu, Nov 3, 2022 at 6:35 PM Christopher Baines <mail@cbaines.net> wrote:

Toggle quote (34 lines)
>
> Kristian Lein-Mathisen <kristianlein@gmail.com> writes:
>
> > I'd like to have avr-gdb available in GNU Guix.
> > I've used the Arch Linux PKGFILE as basis:
> >
> >
> https://github.com/archlinux/svntogit-community/blob/fa92f7b2008ec/trunk/PKGBUILD
>
> Hi Kristian,
>
> This seems OK to me, although I don't know what this package is for?
>
> Given this is inheriting from gdb, it'll have the same synopiss and
> description:
>
> synopsis: The GNU debugger
> description: GDB is the GNU debugger. With it, you can monitor what a
> program
> + is doing while it runs or what it was doing just before a crash. It
> allows
> + you to specify the runtime conditions, to define breakpoints, and to
> change
> + how the program is running to try to fix bugs. It can be used to debug
> + programs written in C, C++, Ada, Objective-C, Pascal and more.
>
> So, I think if there is something different about this avr-gdb, it would
> be good to specify a appropriate synopsis and description. Does that
> make sense?
>
> Thanks,
>
> Chris
>
Attachment: file
From 5a78944fbb6f5768286ccbeaa1168397096a7063 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen <kristianlein@gmail.com>
Date: Wed, 2 Nov 2022 20:36:51 +0100
Subject: [PATCH] gnu: Add avr-gdb.

* gnu/packages/gdb.scm (avr-gdb): New variable.
---
gnu/packages/gdb.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

Toggle diff (33 lines)
diff --git a/gnu/packages/gdb.scm b/gnu/packages/gdb.scm
index 7d8416c7c5..fd0bc80e44 100644
--- a/gnu/packages/gdb.scm
+++ b/gnu/packages/gdb.scm
@@ -171,3 +171,24 @@ (define-public gdb-minimal
(name "gdb-minimal")
(inputs (fold alist-delete (package-inputs gdb)
'("libxml2" "ncurses" "python-wrapper" "source-highlight")))))
+
+(define-public avr-gdb
+ (package/inherit gdb-12
+ (name "avr-gdb")
+ (arguments
+ `(#:configure-flags
+ (list "--target=avr"
+ "--disable-nls"
+ "--enable-languages=c,c++"
+ "--with-system-readline"
+ "--enable-source-highlight")
+ ,@(package-arguments gdb-12)))
+ (synopsis "The GNU Debugger for AVR")
+ (description
+ "GDB is the GNU debugger. With it, you can monitor what a program is
+doing while it runs or what it was doing just before a crash. It allows you
+to specify the runtime conditions, to define breakpoints, and to change how
+the program is running to try to fix bugs.
+
+This variant of GDB can be used to debug programs written for the AVR
+microcontroller architecture.")))

base-commit: 807bfe55dc382b88ab0fdade6886dfa2b15487ee
--
2.38.0
T
T
Thiago Jung Bauermann wrote on 5 Nov 2022 03:21
(name . Kristian Lein-Mathisen)(address . kristianlein@gmail.com)
87bkpm6rgd.fsf@kolabnow.com
Hello Kristian,

Kristian Lein-Mathisen <kristianlein@gmail.com> writes:

Toggle quote (5 lines)
> To be honest, I don't know why the AVR target isn't supported in the standard GDB
> build and I haven't been able to figure out how to list all supported targets. I'm new to GDB in
> general so
> I don't know if I'm the right person to do this writeup.

Normally GDB is built to support only one target. It's possible to make
it support more targets by passing a list of targets (or the special
“all” value) to the ‘--enable-targets’ option of its configure script.

Actually, one alternative to your patch would be to add
“--enable-targets=all” to the configure list of the regular GDB package.
I don't know why distros don't do that. IMHO it's simpler than having
different GDB packages for different architectures. The GDB binary would
get bigger, but not nearly enough that it would be a problem for today's
disks…

Toggle quote (9 lines)
> However, I'm looking at https://github.com/dwtk/dwtk(which I also intend to package for Guix if it's
> of interest),
> and the standard gdb gives me a bunch of error messages when I connect to dwtk's remote
> gdbserver. I'm guessing this
> incompatibility applies to all gdbservers implemented for AVR chips. I haven't found much clarity of
> this in the GDB docs.
> I presume this is the reason most distros package avr-gdb separately from gdb like we're doing
> here.

I think you are right. Ubuntu has a gdb-multiarch package which supports
more targets, but for some reason it doesn't support AVR and has a
separate gdb-avr package. Strange.

Toggle quote (5 lines)
> I've taken the "synopsis" from Arch Linux, removed unsupported languages from the description,
> and just
> mentioned that this is for the specific AVR microcontroller architecture. Please let me know if that's
> good enough.

I think your synopsis and description are good, thank you.
I hope you don't mind if I have one more suggestion: add comments to the
list of configure flags explaining why they're necessary — except for
the “--target=avr” one, which is self-explanatory :-).

Also, out of curiosity: is there a reason why you restrict the enabled
languages to C and C++? A quick search suggests that it's possible to
use Rust as well, maybe more languages?

--
Thanks
Thiago
C
C
Christopher Baines wrote on 7 Nov 2022 20:59
(name . Kristian Lein-Mathisen)(address . kristianlein@gmail.com)
87r0yeo7r8.fsf@cbaines.net
Kristian Lein-Mathisen <kristianlein@gmail.com> writes:

Toggle quote (5 lines)
> Hi Chris and thanks for looking into this,
>
> Your proposal is very reasonable. I wasn't sure what to write but I've
> given it a try in this replacement commit.

The patch you attached looks good to me, I've gone ahead and pushed to
master as d60c9fbf95409a72013d8368e6f50c1ac055df5a.

Thanks!

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmNpY7tfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XewvBAAi6O0C36UHxAKSWaSDu/iX+Ta9VfMW93O
jDWnBtTs5o1eHhLtwyVPI90lkYzhoOSxY4DKwCHMp+khYLVpW9dswYiC/RgfS2jj
sJMQlSeXbTKqlvsZFA6PbWo62m3URopwn6rH24Yr+ZTvVwPRSiNJnEB9a6KhyW3I
5dxuGZHrcOAj2DT7m8DwRyErQftD2TZn2pCqvIQogsb9MexacYSdtzRnyrGrSn43
+lwTAmR4fk9woGt+NXmwHZXK9O0SpnItmfjj88H8CL0vJVgWGo1S6MvYnanvb2Au
FO+bHIL+84Ysw+4WY9iog/sIFsFvTdOiAqsM0bGQ0PAPhyfd7RbpxpoGpyc3kGc/
4sr3LfNpEDJ+4jz514yNnx2ESp0x49ehzOKkZOfIOI59GE1UaJDMKAI69hvWgoUP
+kHAIhOZ0BZPJ3jKCg0WqZujss+BKvL1lTNfX20hoK/Bbp5n+qDf7gZ8/gzeLub9
nTKYlDoQpWqQIIHNM3Sz28o9z+6FEgH90BsV3zVb+o2lixTeoqwVeeGJj7pNlkMf
eDTPCqa2Qd2QInIX7pJDceZbF7Om3WIOCx6Xx5oi/lJkgh7d6ElhFB3nXLdt2iXe
SPb/uaAEnAEM1fFOgVKeRmF1W0vStPjzCSjJfxVF0P3aBsRoMdPmdF8oev11j29W
jlqjq/BgycQ=
=ASHK
-----END PGP SIGNATURE-----

Closed
?