* [Buildroot] [PATCH V2] package: gdb: Add helping kernel gdb functions compilation @ 2023-12-09 21:49 Michael Trimarchi 2023-12-13 20:08 ` Thomas Petazzoni via buildroot 0 siblings, 1 reply; 6+ messages in thread From: Michael Trimarchi @ 2023-12-09 21:49 UTC (permalink / raw) To: buildroot; +Cc: Michael Trimarchi, Yann E . MORIN In order to use all the features of KGDB it's nice to have the possibility to source the vmlinux-gdb.py file. The generation of this file depend on CONFIG_GDB_SCRIPTS config option. Add it in order to use gdb of vmlinux in output directory including tx-* linux script gdb-multiarch --tui output/build/<linux dir>/vmlinux add-auto-load-safe-path output/build/<linux dir> source output/build/<linux dir>/vmlinux-gdb.py Linux needs to be compiled with DEBUG_INFO (without restrict DEBUG_INFO) and kernel cmdline should be modified to wait of kgdb if needed. As example kgdboc_earlycon=ns16550a kgdboc=/dev/ttyS2 kgdbwait nokaslr The test was done on am62x board over serial line. In order to have it running properly we need to compile the agent-proxy ./output/host/bin/agent-proxy 4440 4441 0 /dev/ttyUSB0 115200 gdb can now having the debugging uart available using: target remote localhost:4441 the 4440 is used by the console and 4441 is used to debug [Yann E. MORIN: suggest to change the gdb.mk file instead, changing the kernel.mk file. ] Suggested-by: Yann E. MORIN <yann.morin.1998@free.fr> Tested-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> --- V1->V2: - Yann really help to make it simple and move from a kernel task to an enable configuration to gdb --- package/gdb/gdb.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk index 070598b385..0ebeb08dad 100644 --- a/package/gdb/gdb.mk +++ b/package/gdb/gdb.mk @@ -304,5 +304,9 @@ HOST_GDB_POST_INSTALL_HOOKS += HOST_GDB_ADD_SYMLINK HOST_GDB_POST_INSTALL_HOOKS += gen_gdbinit_file +define HOST_GDB_LINUX_CONFIG_FIXUPS + $(call KCONFIG_ENABLE_OPT,CONFIG_GDB_SCRIPTS) +endef + $(eval $(autotools-package)) $(eval $(host-autotools-package)) -- 2.40.1 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH V2] package: gdb: Add helping kernel gdb functions compilation 2023-12-09 21:49 [Buildroot] [PATCH V2] package: gdb: Add helping kernel gdb functions compilation Michael Trimarchi @ 2023-12-13 20:08 ` Thomas Petazzoni via buildroot 2023-12-13 20:17 ` Michael Nazzareno Trimarchi 0 siblings, 1 reply; 6+ messages in thread From: Thomas Petazzoni via buildroot @ 2023-12-13 20:08 UTC (permalink / raw) To: Michael Trimarchi; +Cc: Yann E . MORIN, buildroot Hello Michael, I think the commit title is not very good/clear, and could be improved. However, I have some more fundamental concern. See below. On Sat, 9 Dec 2023 22:49:18 +0100 Michael Trimarchi <michael@amarulasolutions.com> wrote: > diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk > index 070598b385..0ebeb08dad 100644 > --- a/package/gdb/gdb.mk > +++ b/package/gdb/gdb.mk > @@ -304,5 +304,9 @@ HOST_GDB_POST_INSTALL_HOOKS += HOST_GDB_ADD_SYMLINK > > HOST_GDB_POST_INSTALL_HOOKS += gen_gdbinit_file > > +define HOST_GDB_LINUX_CONFIG_FIXUPS > + $(call KCONFIG_ENABLE_OPT,CONFIG_GDB_SCRIPTS) > +endef I'm not sure I like this. <pkg>_LINUX_CONFIG_FIXUPS is really meant to be used to enable kernel options that are really/absolutely needed for the package to work. I understand that CONFIG_GDB_SCRIPTS is not really adding anything to the kernel image itself, but rather just to the kernel build process, but still I believe it falls outside of the goal of <pkg>_LINUX_CONFIG_FIXUPS. In addition: - Many people will want to use gdb and build a Linux kernel, but not necessarily want to debug the kernel. So "enabling gdb" does not imply "I want to debug the kernel" - This patch does not account for the fairly common case of host gdb being provided by an external toolchain. In this situation, the user still has to enable CONFIG_GDB_SCRIPTS=y "manually" in his kernel configuration. For all those reasons, and even though the change is simple and does no harm, I believe it's not really useful and aligned with the intention of <pkg>_LINUX_CONFIG_FIXUPS. So I would personally be in favor of not accepting this patch. Best regards, Thomas Petazzoni -- Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH V2] package: gdb: Add helping kernel gdb functions compilation 2023-12-13 20:08 ` Thomas Petazzoni via buildroot @ 2023-12-13 20:17 ` Michael Nazzareno Trimarchi 2023-12-13 20:24 ` Thomas Petazzoni via buildroot 0 siblings, 1 reply; 6+ messages in thread From: Michael Nazzareno Trimarchi @ 2023-12-13 20:17 UTC (permalink / raw) To: Thomas Petazzoni; +Cc: Yann E . MORIN, Buildroot Mailing List [-- Attachment #1.1: Type: text/plain, Size: 2042 bytes --] Hi Thomas Il mer 13 dic 2023, 21:08 Thomas Petazzoni <thomas.petazzoni@bootlin.com> ha scritto: > Hello Michael, > > I think the commit title is not very good/clear, and could be improved. > However, I have some more fundamental concern. See below. > > On Sat, 9 Dec 2023 22:49:18 +0100 > Michael Trimarchi <michael@amarulasolutions.com> wrote: > > > diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk > > index 070598b385..0ebeb08dad 100644 > > --- a/package/gdb/gdb.mk > > +++ b/package/gdb/gdb.mk > > @@ -304,5 +304,9 @@ HOST_GDB_POST_INSTALL_HOOKS += HOST_GDB_ADD_SYMLINK > > > > HOST_GDB_POST_INSTALL_HOOKS += gen_gdbinit_file > > > > +define HOST_GDB_LINUX_CONFIG_FIXUPS > > + $(call KCONFIG_ENABLE_OPT,CONFIG_GDB_SCRIPTS) > > +endef > > I'm not sure I like this. <pkg>_LINUX_CONFIG_FIXUPS is really meant to > be used to enable kernel options that are really/absolutely needed for > the package to work. I understand that CONFIG_GDB_SCRIPTS is not really > adding anything to the kernel image itself, but rather just to the > kernel build process, but still I believe it falls outside of the goal > of <pkg>_LINUX_CONFIG_FIXUPS. > > In addition: > > - Many people will want to use gdb and build a Linux kernel, but not > necessarily want to debug the kernel. So "enabling gdb" does not > imply "I want to debug the kernel" > > - This patch does not account for the fairly common case of host gdb > being provided by an external toolchain. In this situation, the user > still has to enable CONFIG_GDB_SCRIPTS=y "manually" in his kernel > configuration. > > For all those reasons, and even though the change is simple and does no > harm, I believe it's not really useful and aligned with the intention > of <pkg>_LINUX_CONFIG_FIXUPS. > > So I would personally be in favor of not accepting this patch. > > Best regards, > My V1 was addressing your concern? Michael > > Thomas Petazzoni > -- > Thomas Petazzoni, co-owner and CEO, Bootlin > Embedded Linux and Kernel engineering and training > https://bootlin.com > [-- Attachment #1.2: Type: text/html, Size: 3334 bytes --] [-- Attachment #2: Type: text/plain, Size: 150 bytes --] _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH V2] package: gdb: Add helping kernel gdb functions compilation 2023-12-13 20:17 ` Michael Nazzareno Trimarchi @ 2023-12-13 20:24 ` Thomas Petazzoni via buildroot 2023-12-13 20:32 ` Michael Nazzareno Trimarchi 0 siblings, 1 reply; 6+ messages in thread From: Thomas Petazzoni via buildroot @ 2023-12-13 20:24 UTC (permalink / raw) To: Michael Nazzareno Trimarchi; +Cc: Yann E . MORIN, Buildroot Mailing List On Wed, 13 Dec 2023 21:17:34 +0100 Michael Nazzareno Trimarchi <michael@amarulasolutions.com> wrote: > My V1 was addressing your concern? No, your v1 was just adding a Buildroot option that allows to enable a kernel option. This is useless, as you can simply enable the kernel option in question, and it doesn't make any sense for Buildroot to replicate 1:1 each kernel option as a Buildroot option. It only makes sense to do so when enabling the kernel option requires that Buildroot builds additional host tools/libraries. But for something as simple as enabling CONFIG_GDB_SCRIPTS, just enable it in your kernel config. Thomas -- Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH V2] package: gdb: Add helping kernel gdb functions compilation 2023-12-13 20:24 ` Thomas Petazzoni via buildroot @ 2023-12-13 20:32 ` Michael Nazzareno Trimarchi 2023-12-13 20:41 ` Yann E. MORIN 0 siblings, 1 reply; 6+ messages in thread From: Michael Nazzareno Trimarchi @ 2023-12-13 20:32 UTC (permalink / raw) To: Thomas Petazzoni; +Cc: Yann E . MORIN, Buildroot Mailing List [-- Attachment #1.1: Type: text/plain, Size: 1088 bytes --] Hi Tomas Il mer 13 dic 2023, 21:24 Thomas Petazzoni <thomas.petazzoni@bootlin.com> ha scritto: > On Wed, 13 Dec 2023 21:17:34 +0100 > Michael Nazzareno Trimarchi <michael@amarulasolutions.com> wrote: > > > My V1 was addressing your concern? > > No, your v1 was just adding a Buildroot option that allows to enable a > kernel option. This is useless, as you can simply enable the kernel > option in question, and it doesn't make any sense for Buildroot to > replicate 1:1 each kernel option as a Buildroot option. It only makes > sense to do so when enabling the kernel option requires that Buildroot > builds additional host tools/libraries. But for something as simple as > enabling CONFIG_GDB_SCRIPTS, just enable it in your kernel config. > I don't think that I enable any option and I just run an other kernel target. Yes but definitely I understand your point. My idea was to keeps some tools build as option as the serial proxy. Michael > Thomas > -- > Thomas Petazzoni, co-owner and CEO, Bootlin > Embedded Linux and Kernel engineering and training > https://bootlin.com > [-- Attachment #1.2: Type: text/html, Size: 1941 bytes --] [-- Attachment #2: Type: text/plain, Size: 150 bytes --] _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH V2] package: gdb: Add helping kernel gdb functions compilation 2023-12-13 20:32 ` Michael Nazzareno Trimarchi @ 2023-12-13 20:41 ` Yann E. MORIN 0 siblings, 0 replies; 6+ messages in thread From: Yann E. MORIN @ 2023-12-13 20:41 UTC (permalink / raw) To: Michael Nazzareno Trimarchi; +Cc: Thomas Petazzoni, Buildroot Mailing List Micheal, All, On 2023-12-13 21:32 +0100, Michael Nazzareno Trimarchi spake thusly: > Il mer 13 dic 2023, 21:24 Thomas Petazzoni <thomas.petazzoni@bootlin.com> > ha scritto: > > On Wed, 13 Dec 2023 21:17:34 +0100 > > Michael Nazzareno Trimarchi <michael@amarulasolutions.com> wrote: > > > My V1 was addressing your concern? > > No, your v1 was just adding a Buildroot option that allows to enable a > > kernel option. This is useless, as you can simply enable the kernel > > option in question, and it doesn't make any sense for Buildroot to > > replicate 1:1 each kernel option as a Buildroot option. It only makes > > sense to do so when enabling the kernel option requires that Buildroot > > builds additional host tools/libraries. But for something as simple as > > enabling CONFIG_GDB_SCRIPTS, just enable it in your kernel config. > I don't think that I enable any option and I just run an other kernel > target. Yes but definitely I understand your point. My idea was to keeps > some tools build as option as the serial proxy. Thomas' point is pretty fair, in fact, and it should have hit me as well when I reviewed v1: if one wants to do kernel debugging, they should be responsible for enabling all appropriate options in their kernel. One such option will have this script installed. Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-12-13 20:41 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-12-09 21:49 [Buildroot] [PATCH V2] package: gdb: Add helping kernel gdb functions compilation Michael Trimarchi 2023-12-13 20:08 ` Thomas Petazzoni via buildroot 2023-12-13 20:17 ` Michael Nazzareno Trimarchi 2023-12-13 20:24 ` Thomas Petazzoni via buildroot 2023-12-13 20:32 ` Michael Nazzareno Trimarchi 2023-12-13 20:41 ` Yann E. MORIN
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox