[1/7] libstdc++: Show full Python stack on error

Message ID 20230928174630.4004388-2-tromey@adacore.com
State Accepted
Headers
Series libstdc++: Use gdb.ValuePrinter in pretty-printers |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Tom Tromey Sept. 28, 2023, 5:46 p.m. UTC
  This changes the libstdc++ test suite to arrange for gdb to show the
full Python stack if any sort of Python exception occurs.  This makes
debugging the printers a little simpler.

libstdc++-v3/ChangeLog:

        * testsuite/lib/gdb-test.exp (gdb-test): Enable Python
        stack traces from gdb.
---
 libstdc++-v3/testsuite/lib/gdb-test.exp | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Jonathan Wakely Sept. 28, 2023, 6:49 p.m. UTC | #1
On Thu, 28 Sept 2023, 18:48 Tom Tromey via Libstdc++, <libstdc++@gcc.gnu.org>
wrote:

> This changes the libstdc++ test suite to arrange for gdb to show the
> full Python stack if any sort of Python exception occurs.  This makes
> debugging the printers a little simpler.
>

Oh I wish I'd known about this sooner.

OK for trunk, thanks.


> libstdc++-v3/ChangeLog:
>
>         * testsuite/lib/gdb-test.exp (gdb-test): Enable Python
>         stack traces from gdb.
> ---
>  libstdc++-v3/testsuite/lib/gdb-test.exp | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libstdc++-v3/testsuite/lib/gdb-test.exp
> b/libstdc++-v3/testsuite/lib/gdb-test.exp
> index d8e572ef7b3..af7d970d388 100644
> --- a/libstdc++-v3/testsuite/lib/gdb-test.exp
> +++ b/libstdc++-v3/testsuite/lib/gdb-test.exp
> @@ -141,6 +141,8 @@ proc gdb-test { marker {selector {}} {load_xmethods 0}
> } {
>      puts $fd "set auto-load no"
>      # Now that we've disabled auto-load, it's safe to set the target file
>      puts $fd "file ./$output_file"
> +    # See the full backtrace of any failures.
> +    puts $fd "set python print-stack full"
>      # Load & register *our* copy of the pretty-printers
>      puts $fd "source $printer_code"
>      puts $fd "python register_libstdcxx_printers(None)"
> --
> 2.40.1
>
>
  

Patch

diff --git a/libstdc++-v3/testsuite/lib/gdb-test.exp b/libstdc++-v3/testsuite/lib/gdb-test.exp
index d8e572ef7b3..af7d970d388 100644
--- a/libstdc++-v3/testsuite/lib/gdb-test.exp
+++ b/libstdc++-v3/testsuite/lib/gdb-test.exp
@@ -141,6 +141,8 @@  proc gdb-test { marker {selector {}} {load_xmethods 0} } {
     puts $fd "set auto-load no"
     # Now that we've disabled auto-load, it's safe to set the target file
     puts $fd "file ./$output_file"
+    # See the full backtrace of any failures.
+    puts $fd "set python print-stack full"
     # Load & register *our* copy of the pretty-printers
     puts $fd "source $printer_code"
     puts $fd "python register_libstdcxx_printers(None)"