All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] docs/manual/using-buildroot-debugger: suggest '-ix' iso '-x' when loading gdbinit
@ 2021-09-13  7:29 Thomas De Schampheleire
  2021-09-13  7:29 ` [Buildroot] [PATCH 2/2] toolchain/helpers.mk: gdbinit: set auto-load-safe-path before sysroot Thomas De Schampheleire
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Thomas De Schampheleire @ 2021-09-13  7:29 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas De Schampheleire

From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

A gdbinit file passed via '-x' will be read _after_ parsing any
object/core file passed on the command-line. In cross-compilation context,
this is particularly a problem when loading a core file, because without the
'sysroot' specified in the gdbinit file, it will give a lot of warnings,
like:

    warning: .dynamic section for "/lib/libstdc++.so.6" is not at the expected address (wrong library or version mismatch?)
    warning: .dynamic section for "/lib/librt.so.1" is not at the expected address (wrong library or version mismatch?)
    warning: .dynamic section for "/lib/libm.so.6" is not at the expected address (wrong library or version mismatch?)
    warning: .dynamic section for "/lib/libgcc_s.so.1" is not at the expected address (wrong library or version mismatch?)
    warning: .dynamic section for "/lib/libc.so.6" is not at the expected address (wrong library or version mismatch?)
    warning: .dynamic section for "/lib/ld-linux.so.2" is not at the expected address (wrong library or version mismatch?)
    warning: .dynamic section for "/lib/libanl.so.1" is not at the expected address (wrong library or version mismatch?)
    warning: .dynamic section for "/lib/libdl.so.2" is not at the expected address (wrong library or version mismatch?)
    warning: .dynamic section for "/lib/libpthread.so.0" is not at the expected address (wrong library or version mismatch?)
    warning: .dynamic section for "/usr/lib/libz.so.1" is not at the expected address (wrong library or version mismatch?)
    warning: .dynamic section for "/lib/libnss_files.so.2" is not at the expected address (wrong library or version mismatch?)

    warning: Could not load shared library symbols for 17 libraries, e.g. [...]
    Use the "info sharedlibrary" command to see the complete listing.
    Do you need "set solib-search-path" or "set sysroot"?

In contrast, the '-ix' option will load the specified gdbinit file _before_
parsing object/core files. This will remove said warnings.

See also: https://sourceware.org/bugzilla/show_bug.cgi?id=28330

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
 docs/manual/using-buildroot-debugger.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/manual/using-buildroot-debugger.txt b/docs/manual/using-buildroot-debugger.txt
index d5293beb53..9a8a7dfbaf 100644
--- a/docs/manual/using-buildroot-debugger.txt
+++ b/docs/manual/using-buildroot-debugger.txt
@@ -35,7 +35,7 @@ Then, on the host, you should start the cross gdb using the following
 command line:
 
 ----------------------------
-<buildroot>/output/host/bin/<tuple>-gdb -x <buildroot>/output/staging/usr/share/buildroot/gdbinit foo
+<buildroot>/output/host/bin/<tuple>-gdb -ix <buildroot>/output/staging/usr/share/buildroot/gdbinit foo
 ----------------------------
 
 Of course, +foo+ must be available in the current directory, built
-- 
2.32.0

_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/2] toolchain/helpers.mk: gdbinit: set auto-load-safe-path before sysroot
  2021-09-13  7:29 [Buildroot] [PATCH 1/2] docs/manual/using-buildroot-debugger: suggest '-ix' iso '-x' when loading gdbinit Thomas De Schampheleire
@ 2021-09-13  7:29 ` Thomas De Schampheleire
  2021-09-21 20:46   ` Arnout Vandecappelle
  2021-10-04 20:24   ` Peter Korsgaard
  2021-09-21 20:43 ` [Buildroot] [PATCH 1/2] docs/manual/using-buildroot-debugger: suggest '-ix' iso '-x' when loading gdbinit Arnout Vandecappelle
  2021-10-04 20:22 ` Peter Korsgaard
  2 siblings, 2 replies; 7+ messages in thread
From: Thomas De Schampheleire @ 2021-09-13  7:29 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Thomas De Schampheleire

From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

The gdbinit supplied by Buildroot does two things:
A. specify the sysroot where gdb can find shared libraries
B. mark the sysroot as a 'safe path' for its auto-load feature, to make sure
  that pretty printers for libstdc++.so are added automatically (see commit
  6fb3216a80c64c08375429d89497eaeec5622150)

When debugging a core file, and the gdbinit file is specified via '-x'
rather than '-ix', then the order of these settings matters: If you first
set the sysroot, then gdb will immediately start finding the shared
libraries it needs for the core file, detect libstdc++ and its associated
libstdc++-gdb.py file, then give a big warning about safe paths:

  warning: File ".../i686-buildroot-linux-gnu/sysroot/lib/libstdc++.so.6.0.24-gdb.py"
          auto-loading has been declined by your `auto-load safe-path' set
          to "$debugdir:$datadir/auto-load".
  To enable execution of this file add
          add-auto-load-safe-path .../i686-buildroot-linux-gnu/sysroot/lib/libstdc++.so.6.0.24-gdb.py
  line to your configuration file "/home/me/.gdbinit".
  To completely disable this security protection add
          set auto-load safe-path /
  line to your configuration file "/home/me/.gdbinit".
  For more information about this security protection see the
  "Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
          info "(gdb)Auto-loading safe path"

and the pretty printing code is not loaded. This is because the second
line from the gdbinit file was not yet parsed at this point.

By changing the order (first configuring the safe path, then setting the
sysroot), this issue does not appear and everything is as expected.

Note that when '-ix' were used instead of '-x' to pass the gdbinit file to
gdb, then the order would not matter, because the entire gdbinit file would
be parsed before considering the core file.
However, even though the Buildroot manual now suggests '-ix', users may not
have noticed this change and continue to use '-x'.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
 toolchain/helpers.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 1dfb52ac38..ef8e9a5f64 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -481,8 +481,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 "add-auto-load-safe-path $(STAGING_DIR)" >> $(STAGING_DIR)/usr/share/buildroot/gdbinit
+	echo "add-auto-load-safe-path $(STAGING_DIR)" > $(STAGING_DIR)/usr/share/buildroot/gdbinit ; \
+	echo "set sysroot $(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.32.0

_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 1/2] docs/manual/using-buildroot-debugger: suggest '-ix' iso '-x' when loading gdbinit
  2021-09-13  7:29 [Buildroot] [PATCH 1/2] docs/manual/using-buildroot-debugger: suggest '-ix' iso '-x' when loading gdbinit Thomas De Schampheleire
  2021-09-13  7:29 ` [Buildroot] [PATCH 2/2] toolchain/helpers.mk: gdbinit: set auto-load-safe-path before sysroot Thomas De Schampheleire
@ 2021-09-21 20:43 ` Arnout Vandecappelle
  2021-10-04 20:22 ` Peter Korsgaard
  2 siblings, 0 replies; 7+ messages in thread
From: Arnout Vandecappelle @ 2021-09-21 20:43 UTC (permalink / raw)
  To: Thomas De Schampheleire, buildroot; +Cc: Thomas De Schampheleire



On 13/09/2021 09:29, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> 
> A gdbinit file passed via '-x' will be read _after_ parsing any
> object/core file passed on the command-line. In cross-compilation context,
> this is particularly a problem when loading a core file, because without the
> 'sysroot' specified in the gdbinit file, it will give a lot of warnings,
> like:
> 
>      warning: .dynamic section for "/lib/libstdc++.so.6" is not at the expected address (wrong library or version mismatch?)
>      warning: .dynamic section for "/lib/librt.so.1" is not at the expected address (wrong library or version mismatch?)
>      warning: .dynamic section for "/lib/libm.so.6" is not at the expected address (wrong library or version mismatch?)
>      warning: .dynamic section for "/lib/libgcc_s.so.1" is not at the expected address (wrong library or version mismatch?)
>      warning: .dynamic section for "/lib/libc.so.6" is not at the expected address (wrong library or version mismatch?)
>      warning: .dynamic section for "/lib/ld-linux.so.2" is not at the expected address (wrong library or version mismatch?)
>      warning: .dynamic section for "/lib/libanl.so.1" is not at the expected address (wrong library or version mismatch?)
>      warning: .dynamic section for "/lib/libdl.so.2" is not at the expected address (wrong library or version mismatch?)
>      warning: .dynamic section for "/lib/libpthread.so.0" is not at the expected address (wrong library or version mismatch?)
>      warning: .dynamic section for "/usr/lib/libz.so.1" is not at the expected address (wrong library or version mismatch?)
>      warning: .dynamic section for "/lib/libnss_files.so.2" is not at the expected address (wrong library or version mismatch?)
> 
>      warning: Could not load shared library symbols for 17 libraries, e.g. [...]
>      Use the "info sharedlibrary" command to see the complete listing.
>      Do you need "set solib-search-path" or "set sysroot"?
> 
> In contrast, the '-ix' option will load the specified gdbinit file _before_
> parsing object/core files. This will remove said warnings.

  I didn't know this!

  Applied to master, thanks.

  Regards,
  Arnout

> 
> See also: https://sourceware.org/bugzilla/show_bug.cgi?id=28330
> 
> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> ---
>   docs/manual/using-buildroot-debugger.txt | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/docs/manual/using-buildroot-debugger.txt b/docs/manual/using-buildroot-debugger.txt
> index d5293beb53..9a8a7dfbaf 100644
> --- a/docs/manual/using-buildroot-debugger.txt
> +++ b/docs/manual/using-buildroot-debugger.txt
> @@ -35,7 +35,7 @@ Then, on the host, you should start the cross gdb using the following
>   command line:
>   
>   ----------------------------
> -<buildroot>/output/host/bin/<tuple>-gdb -x <buildroot>/output/staging/usr/share/buildroot/gdbinit foo
> +<buildroot>/output/host/bin/<tuple>-gdb -ix <buildroot>/output/staging/usr/share/buildroot/gdbinit foo
>   ----------------------------
>   
>   Of course, +foo+ must be available in the current directory, built
> 
_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 2/2] toolchain/helpers.mk: gdbinit: set auto-load-safe-path before sysroot
  2021-09-13  7:29 ` [Buildroot] [PATCH 2/2] toolchain/helpers.mk: gdbinit: set auto-load-safe-path before sysroot Thomas De Schampheleire
@ 2021-09-21 20:46   ` Arnout Vandecappelle
  2021-09-22  9:10     ` Thomas De Schampheleire
  2021-10-04 20:24   ` Peter Korsgaard
  1 sibling, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2021-09-21 20:46 UTC (permalink / raw)
  To: Thomas De Schampheleire, buildroot
  Cc: Thomas De Schampheleire, Giulio Benetti, Romain Naour, Thomas Petazzoni



On 13/09/2021 09:29, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> 
> The gdbinit supplied by Buildroot does two things:
> A. specify the sysroot where gdb can find shared libraries
> B. mark the sysroot as a 'safe path' for its auto-load feature, to make sure
>    that pretty printers for libstdc++.so are added automatically (see commit
>    6fb3216a80c64c08375429d89497eaeec5622150)
> 
> When debugging a core file, and the gdbinit file is specified via '-x'
> rather than '-ix', then the order of these settings matters: If you first
> set the sysroot, then gdb will immediately start finding the shared
> libraries it needs for the core file, detect libstdc++ and its associated
> libstdc++-gdb.py file, then give a big warning about safe paths:
> 
>    warning: File ".../i686-buildroot-linux-gnu/sysroot/lib/libstdc++.so.6.0.24-gdb.py"
>            auto-loading has been declined by your `auto-load safe-path' set
>            to "$debugdir:$datadir/auto-load".
>    To enable execution of this file add
>            add-auto-load-safe-path .../i686-buildroot-linux-gnu/sysroot/lib/libstdc++.so.6.0.24-gdb.py
>    line to your configuration file "/home/me/.gdbinit".
>    To completely disable this security protection add
>            set auto-load safe-path /
>    line to your configuration file "/home/me/.gdbinit".
>    For more information about this security protection see the
>    "Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
>            info "(gdb)Auto-loading safe path"
> 
> and the pretty printing code is not loaded. This is because the second
> line from the gdbinit file was not yet parsed at this point.
> 
> By changing the order (first configuring the safe path, then setting the
> sysroot), this issue does not appear and everything is as expected.
> 
> Note that when '-ix' were used instead of '-x' to pass the gdbinit file to
> gdb, then the order would not matter, because the entire gdbinit file would
> be parsed before considering the core file.
> However, even though the Buildroot manual now suggests '-ix', users may not
> have noticed this change and continue to use '-x'.

  Whaa, excellent, not content with fixing a bug once, you fix it twice!

  Applied to master, thanks. :-)

  Regards,
  Arnout


> 
> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> ---
>   toolchain/helpers.mk | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index 1dfb52ac38..ef8e9a5f64 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -481,8 +481,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 "add-auto-load-safe-path $(STAGING_DIR)" >> $(STAGING_DIR)/usr/share/buildroot/gdbinit
> +	echo "add-auto-load-safe-path $(STAGING_DIR)" > $(STAGING_DIR)/usr/share/buildroot/gdbinit ; \
> +	echo "set sysroot $(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
> 
_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 2/2] toolchain/helpers.mk: gdbinit: set auto-load-safe-path before sysroot
  2021-09-21 20:46   ` Arnout Vandecappelle
@ 2021-09-22  9:10     ` Thomas De Schampheleire
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas De Schampheleire @ 2021-09-22  9:10 UTC (permalink / raw)
  To: Arnout Vandecappelle
  Cc: Thomas De Schampheleire, Giulio Benetti, Romain Naour,
	Thomas Petazzoni, buildroot

Hi Arnout,

El mar, 21 sept 2021 a las 22:46, Arnout Vandecappelle
(<arnout@mind.be>) escribió:
>
>
>
> On 13/09/2021 09:29, Thomas De Schampheleire wrote:
> > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> >
> > The gdbinit supplied by Buildroot does two things:
> > A. specify the sysroot where gdb can find shared libraries
> > B. mark the sysroot as a 'safe path' for its auto-load feature, to make sure
> >    that pretty printers for libstdc++.so are added automatically (see commit
> >    6fb3216a80c64c08375429d89497eaeec5622150)
> >
> > When debugging a core file, and the gdbinit file is specified via '-x'
> > rather than '-ix', then the order of these settings matters: If you first
> > set the sysroot, then gdb will immediately start finding the shared
> > libraries it needs for the core file, detect libstdc++ and its associated
> > libstdc++-gdb.py file, then give a big warning about safe paths:
> >
> >    warning: File ".../i686-buildroot-linux-gnu/sysroot/lib/libstdc++.so.6.0.24-gdb.py"
> >            auto-loading has been declined by your `auto-load safe-path' set
> >            to "$debugdir:$datadir/auto-load".
> >    To enable execution of this file add
> >            add-auto-load-safe-path .../i686-buildroot-linux-gnu/sysroot/lib/libstdc++.so.6.0.24-gdb.py
> >    line to your configuration file "/home/me/.gdbinit".
> >    To completely disable this security protection add
> >            set auto-load safe-path /
> >    line to your configuration file "/home/me/.gdbinit".
> >    For more information about this security protection see the
> >    "Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
> >            info "(gdb)Auto-loading safe path"
> >
> > and the pretty printing code is not loaded. This is because the second
> > line from the gdbinit file was not yet parsed at this point.
> >
> > By changing the order (first configuring the safe path, then setting the
> > sysroot), this issue does not appear and everything is as expected.
> >
> > Note that when '-ix' were used instead of '-x' to pass the gdbinit file to
> > gdb, then the order would not matter, because the entire gdbinit file would
> > be parsed before considering the core file.
> > However, even though the Buildroot manual now suggests '-ix', users may not
> > have noticed this change and continue to use '-x'.
>
>   Whaa, excellent, not content with fixing a bug once, you fix it twice!


Just to clarify: there were two sets of warnings:

1. problems loading shared libraries
2. problems with the auto-load path / pretty printers

Switching from -x to -ix solves both problems.
But if you stick with '-x', this second patch only fixes the second
problem, not the first.

Best regards,
Thomas
_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 1/2] docs/manual/using-buildroot-debugger: suggest '-ix' iso '-x' when loading gdbinit
  2021-09-13  7:29 [Buildroot] [PATCH 1/2] docs/manual/using-buildroot-debugger: suggest '-ix' iso '-x' when loading gdbinit Thomas De Schampheleire
  2021-09-13  7:29 ` [Buildroot] [PATCH 2/2] toolchain/helpers.mk: gdbinit: set auto-load-safe-path before sysroot Thomas De Schampheleire
  2021-09-21 20:43 ` [Buildroot] [PATCH 1/2] docs/manual/using-buildroot-debugger: suggest '-ix' iso '-x' when loading gdbinit Arnout Vandecappelle
@ 2021-10-04 20:22 ` Peter Korsgaard
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2021-10-04 20:22 UTC (permalink / raw)
  To: Thomas De Schampheleire; +Cc: Thomas De Schampheleire, buildroot

>>>>> "Thomas" == Thomas De Schampheleire <patrickdepinguin@gmail.com> writes:

 > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
 > A gdbinit file passed via '-x' will be read _after_ parsing any
 > object/core file passed on the command-line. In cross-compilation context,
 > this is particularly a problem when loading a core file, because without the
 > 'sysroot' specified in the gdbinit file, it will give a lot of warnings,
 > like:

 >     warning: .dynamic section for "/lib/libstdc++.so.6" is not at the expected address (wrong library or version mismatch?)
 >     warning: .dynamic section for "/lib/librt.so.1" is not at the expected address (wrong library or version mismatch?)
 >     warning: .dynamic section for "/lib/libm.so.6" is not at the expected address (wrong library or version mismatch?)
 >     warning: .dynamic section for "/lib/libgcc_s.so.1" is not at the expected address (wrong library or version mismatch?)
 >     warning: .dynamic section for "/lib/libc.so.6" is not at the expected address (wrong library or version mismatch?)
 >     warning: .dynamic section for "/lib/ld-linux.so.2" is not at the expected address (wrong library or version mismatch?)
 >     warning: .dynamic section for "/lib/libanl.so.1" is not at the expected address (wrong library or version mismatch?)
 >     warning: .dynamic section for "/lib/libdl.so.2" is not at the expected address (wrong library or version mismatch?)
 >     warning: .dynamic section for "/lib/libpthread.so.0" is not at the expected address (wrong library or version mismatch?)
 >     warning: .dynamic section for "/usr/lib/libz.so.1" is not at the expected address (wrong library or version mismatch?)
 >     warning: .dynamic section for "/lib/libnss_files.so.2" is not at the expected address (wrong library or version mismatch?)

 >     warning: Could not load shared library symbols for 17 libraries, e.g. [...]
 >     Use the "info sharedlibrary" command to see the complete listing.
 >     Do you need "set solib-search-path" or "set sysroot"?

 > In contrast, the '-ix' option will load the specified gdbinit file _before_
 > parsing object/core files. This will remove said warnings.

 > See also: https://sourceware.org/bugzilla/show_bug.cgi?id=28330

 > Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

Committed to 2021.02.x, 2021.05.x and 2021.08.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 2/2] toolchain/helpers.mk: gdbinit: set auto-load-safe-path before sysroot
  2021-09-13  7:29 ` [Buildroot] [PATCH 2/2] toolchain/helpers.mk: gdbinit: set auto-load-safe-path before sysroot Thomas De Schampheleire
  2021-09-21 20:46   ` Arnout Vandecappelle
@ 2021-10-04 20:24   ` Peter Korsgaard
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2021-10-04 20:24 UTC (permalink / raw)
  To: Thomas De Schampheleire
  Cc: Thomas De Schampheleire, Giulio Benetti, Romain Naour,
	Thomas Petazzoni, buildroot

>>>>> "Thomas" == Thomas De Schampheleire <patrickdepinguin@gmail.com> writes:

 > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
 > The gdbinit supplied by Buildroot does two things:
 > A. specify the sysroot where gdb can find shared libraries
 > B. mark the sysroot as a 'safe path' for its auto-load feature, to make sure
 >   that pretty printers for libstdc++.so are added automatically (see commit
 >   6fb3216a80c64c08375429d89497eaeec5622150)

 > When debugging a core file, and the gdbinit file is specified via '-x'
 > rather than '-ix', then the order of these settings matters: If you first
 > set the sysroot, then gdb will immediately start finding the shared
 > libraries it needs for the core file, detect libstdc++ and its associated
 > libstdc++-gdb.py file, then give a big warning about safe paths:

 >   warning: File ".../i686-buildroot-linux-gnu/sysroot/lib/libstdc++.so.6.0.24-gdb.py"
 >           auto-loading has been declined by your `auto-load safe-path' set
 >           to "$debugdir:$datadir/auto-load".
 >   To enable execution of this file add
 >           add-auto-load-safe-path .../i686-buildroot-linux-gnu/sysroot/lib/libstdc++.so.6.0.24-gdb.py
 >   line to your configuration file "/home/me/.gdbinit".
 >   To completely disable this security protection add
 >           set auto-load safe-path /
 >   line to your configuration file "/home/me/.gdbinit".
 >   For more information about this security protection see the
 >   "Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
 >           info "(gdb)Auto-loading safe path"

 > and the pretty printing code is not loaded. This is because the second
 > line from the gdbinit file was not yet parsed at this point.

 > By changing the order (first configuring the safe path, then setting the
 > sysroot), this issue does not appear and everything is as expected.

 > Note that when '-ix' were used instead of '-x' to pass the gdbinit file to
 > gdb, then the order would not matter, because the entire gdbinit file would
 > be parsed before considering the core file.
 > However, even though the Buildroot manual now suggests '-ix', users may not
 > have noticed this change and continue to use '-x'.

 > Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

Committed to 2021.08.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-04 20:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13  7:29 [Buildroot] [PATCH 1/2] docs/manual/using-buildroot-debugger: suggest '-ix' iso '-x' when loading gdbinit Thomas De Schampheleire
2021-09-13  7:29 ` [Buildroot] [PATCH 2/2] toolchain/helpers.mk: gdbinit: set auto-load-safe-path before sysroot Thomas De Schampheleire
2021-09-21 20:46   ` Arnout Vandecappelle
2021-09-22  9:10     ` Thomas De Schampheleire
2021-10-04 20:24   ` Peter Korsgaard
2021-09-21 20:43 ` [Buildroot] [PATCH 1/2] docs/manual/using-buildroot-debugger: suggest '-ix' iso '-x' when loading gdbinit Arnout Vandecappelle
2021-10-04 20:22 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.