package: gdb: Add helping kernel gdb functions compilation
PATCH v2 1/1 package: gdb: Add helping kernel gdb functions compilation
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. ]
---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(+)
package/gdb/gdb.mk +4 -0
@@ -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))
Signature · 6 lines
2.40.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/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.
package/gdb/gdb.mk HOST_GDB_POST_INSTALL_HOOKS += HOST_GDB_ADD_SYMLINK · line 309
Quoted 11 lines · On Sat, 9 Dec 2023 22:49:18 +0100 Michael Trimarchi…
package/gdb/gdb.mk +3
-0@@ -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
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Thomas
Il mer 13 dic 2023, 21:08 Thomas Petazzoni <[email protected]> ha scritto:
Quoted 38 lines
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.
package/gdb/gdb.mk HOST_GDB_POST_INSTALL_HOOKS += HOST_GDB_ADD_SYMLINK · line 309
Quoted 11 lines · On Sat, 9 Dec 2023 22:49:18 +0100 Michael Trimarchi…
package/gdb/gdb.mk +3
-0@@ -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) +endefI'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_SCRIPTSis 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.
Quoted 8 lines
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
Quoted 7 lines
Thomas Petazzoni
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 1 line · On Wed, 13 Dec 2023 21:17:34 +0100 Michael Nazzareno Trimarchi…
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
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Tomas
Il mer 13 dic 2023, 21:24 Thomas Petazzoni <[email protected]> ha scritto:
Quoted 5 lines
Quoted 1 line · On Wed, 13 Dec 2023 21:17:34 +0100 Michael Nazzareno Trimarchi…
My V1 was addressing your concern?
Quoted 8 lines
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 enablingCONFIG_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
Quoted 6 lines
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Micheal, All,
On 2023-12-13 21:32 +0100, Michael Nazzareno Trimarchi spake thusly:
Quoted 12 lines
Il mer 13 dic 2023, 21:24 Thomas Petazzoni <[email protected]> ha scritto:
Quoted 10 lines
Quoted 1 line · On Wed, 13 Dec 2023 21:17:34 +0100 Michael Nazzareno Trimarchi…
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 enablingCONFIG_GDB_SCRIPTS, just enable it in your kernel config.
Quoted 3 lines
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.
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | 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 [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot