First figure out what is blocking. The best way is to use ps to find the running process and then gdb -p <pid> to attach the debugger.
Now you can inspect threads and get their backtrace. You can also get a backtrace of the Prolog stack using
(gdb) printf "%s\n", PL_backtrace_string(25,0)
The 25 is the max number of frames to print and the 0 asks for a normal Prolog stack. You can also pass 1, which merely lists the predicates and code offsets rather than the goals with arguments. The latter “always” works, while the first may deadlock or crash if Prolog is in some bad state.