[Buildroot] [PATCH V2] package: gdb: Add helping kernel gdb functions compilation

Michael Trimarchi michael at amarulasolutions.com
Sat Dec 9 21:49:18 UTC 2023


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 at free.fr> 
Tested-by: Michael Trimarchi <michael at amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael at 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




More information about the buildroot mailing list