Skip to content

Commit

Permalink
DEBUG: First print the Prolog stack "safe" on a crash.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JanWielemaker committed Nov 6, 2024
1 parent 1edb023 commit f48b046
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pl-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f48b046

Please sign in to comment.