From f48b0463dd619642f2d51d74bffeedade950c8d4 Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Wed, 6 Nov 2024 13:09:32 +0100 Subject: [PATCH] DEBUG: First print the Prolog stack "safe" on a crash. This guarantees that the stack is printed, including details on the clauses involved and progress in each clause. Next, the stacks are printed with arguments. This however may crash if the crash is caused by corrupt data on the stacks. --- src/pl-init.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pl-init.c b/src/pl-init.c index 582bb680e9..10cb1ce4e3 100644 --- a/src/pl-init.c +++ b/src/pl-init.c @@ -1825,8 +1825,12 @@ printCrashContext(const char *btname) print_backtrace_named("GC"); } } - Sdprintf("\n\nPROLOG STACK:\n"); - PL_backtrace(10, btflags); + Sdprintf("\n\nPROLOG STACK (without arguments):\n"); + PL_backtrace(10, PL_BT_SAFE); + if ( !(btflags&PL_BT_SAFE) ) + { Sdprintf("\n\nPROLOG STACK (with arguments; may crash if data is corrupted):\n"); + PL_backtrace(10, btflags); + } } running = false;