]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
selftest/gdb_backtrace: print python traceback if available
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 7 Mar 2024 09:30:24 +0000 (22:30 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 20 Mar 2024 23:42:34 +0000 (23:42 +0000)
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 <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
selftest/gdb_backtrace

index ec2396a630e34a6de91da5acdb7bd01cc5985920..7ab50f3138c329b9f97456e03d9b4d739b7e5704 100755 (executable)
@@ -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}" </dev/null