From: Douglas Bagnall Date: Thu, 7 Mar 2024 09:30:24 +0000 (+1300) Subject: selftest/gdb_backtrace: print python traceback if available X-Git-Tag: tdb-1.4.11~1416 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=904479cdf6d58142baa012a7b588fca857f275f4;p=thirdparty%2Fsamba.git selftest/gdb_backtrace: print python traceback if available If a program happens to have 'PyList_New' defined but is not a python script, gdb will print > Undefined command: "py-bt". Try "help". and probably stop. This happens after the C backtraces have been printed, so nothing is lost. The traceback is printed twice -- once in conventional Python style for clarity, and once with extra "full" information. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/selftest/gdb_backtrace b/selftest/gdb_backtrace index ec2396a630e..7ab50f3138c 100755 --- a/selftest/gdb_backtrace +++ b/selftest/gdb_backtrace @@ -134,6 +134,14 @@ set height 0 bt full thread apply all bt full info locals +if PyList_New + echo \\n### Python traceback\\n\\n + py-bt + echo \\n### Python locals\\n\\n + py-locals + echo \\n### Python full traceback\\n\\n + py-bt-full +end quit EOF ${DB_BIN} -batch -x "${BATCHFILE_MAIN}" --pid "${PID}"