From 6fb3216a80c64c08375429d89497eaeec5622150 Mon Sep 17 00:00:00 2001 From: Thomas De Schampheleire Date: Tue, 8 Jun 2021 17:18:39 +0200 Subject: [PATCH] toolchain: mark sysroot as 'safe' path for gdb auto-load gdb can automatically load certain files as described in [1]. Such files could install pretty-printers for complex data structures. libstdcxx (C++ standard library) provided by gcc, is one example of a library for which such auto-load file is available. But there are other examples too, like libglib2. However, gdb will only auto-load files if the file is located in one of the locations treated as 'safe'. The Buildroot sysroot is not by default in that list. Provide a better debugging experience by adding the sysroot to the 'safe' list, via the gdbinit file prepared by Buildroot. [1] https://sourceware.org/gdb/onlinedocs/gdb/objfile_002dgdbdotext-file.html Signed-off-by: Thomas De Schampheleire Signed-off-by: Thomas Petazzoni --- toolchain/helpers.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 17bc159f3e..dfb2581ed5 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -483,7 +483,8 @@ check_toolchain_ssp = \ # gen_gdbinit_file = \ mkdir -p $(STAGING_DIR)/usr/share/buildroot/ ; \ - echo "set sysroot $(STAGING_DIR)" > $(STAGING_DIR)/usr/share/buildroot/gdbinit + echo "set sysroot $(STAGING_DIR)" > $(STAGING_DIR)/usr/share/buildroot/gdbinit ; \ + echo "add-auto-load-safe-path $(STAGING_DIR)" >> $(STAGING_DIR)/usr/share/buildroot/gdbinit # Given a path, determine the relative prefix (../) needed to return to the # root level. Note that the last component is treated as a file component; use a -- 2.30.2