From 12ce289922ca594384ffb9e035fcd9815e2aa331 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 7 Mar 2024 23:13:56 +1300 Subject: [PATCH] selftest/gdb_backtrace: avoid printing backtrace twice with 1 thread We call 'thread apply all bt full' in case there are interesting things going on in other threads, but often there are no other threads and it only serves to repeat the original trace (and very slowly, for some reason). The $_inferior_thread_count convenience variable is new in gdb 13.1 (2022-ish) so we init-if-undefined it to default to the old behaviour. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- selftest/gdb_backtrace | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/selftest/gdb_backtrace b/selftest/gdb_backtrace index 7ab50f3138c..b97766c2e18 100755 --- a/selftest/gdb_backtrace +++ b/selftest/gdb_backtrace @@ -132,7 +132,10 @@ gdb) cat <${BATCHFILE_MAIN} set height 0 bt full -thread apply all bt full +init-if-undefined \$_inferior_thread_count = 0 +if \$_inferior_thread_count != 1 + thread apply all bt full +end info locals if PyList_New echo \\n### Python traceback\\n\\n -- 2.11.4.GIT