How to debug "received fatal signal"

Wouter Beek <[email protected]> Sat, 19 Apr 2014 12:52:04 +0200
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAE1un7PK72-9Mwv_8PVas_kGCJ0X6w0esKyHaXv-MEwTD_+kHA@mail.gmail.com>
Hi Prologgers,

I am running a Prolog program on a remote server to download all
Linked Open Data that is described in the CKAN repository datahub.io.
These are overall very big datasets and running the complete script
takes quite a while. For some reason that I would like to figure out,
the Prolog program stops with the below included output.

My question is: what would be the/a best practice to debug this in a
smart/focused way (i.e., except for populating most of my code with
debug statements)? Am I able to catch this error in C and then get a
little more info on what is in the Prolog stack at the moment the
exception is thrown?

~~~
SWI-Prolog [thread 62]: received fatal signal 11 (segv)
C-stack trace labeled "crash":
  [0] /home/wbk440/lib/swipl-7.1.11/lib/x86_64-linux/libswipl.so.7.1.11(+0xd6dd7)
[0x7ffff7dabdd7]
  [1] /home/wbk440/lib/swipl-7.1.11/lib/x86_64-linux/libswipl.so.7.1.11(+0xd6e7e)
[0x7ffff7dabe7e]
  [2] /home/wbk440/lib/swipl-7.1.11/lib/x86_64-linux/libswipl.so.7.1.11(+0x89065)
[0x7ffff7d5e065]
  [3] /lib64/libpthread.so.0() [0x326740f710]
  [4] /lib64/libc.so.6() [0x326687873b]
  [5] /home/wbk440/lib/swipl-7.1.11/lib/x86_64-linux/libswipl.so.7.1.11(+0xc402b)
[0x7ffff7d9902b]
  [6] /home/wbk440/lib/swipl-7.1.11/lib/x86_64-linux/libswipl.so.7.1.11(+0xc421c)
[0x7ffff7d9921c]
  [7] /home/wbk440/lib/swipl-7.1.11/lib/x86_64-linux/libswipl.so.7.1.11(+0xc471c)
[0x7ffff7d9971c]
  [8] /home/wbk440/lib/swipl-7.1.11/lib/x86_64-linux/libswipl.so.7.1.11(+0xc577e)
[0x7ffff7d9a77e]
  [9] /home/wbk440/lib/swipl-7.1.11/lib/x86_64-linux/libswipl.so.7.1.11(+0xc0fc0)
[0x7ffff7d95fc0]
  [10] /home/wbk440/lib/swipl-7.1.11/lib/x86_64-linux/libswipl.so.7.1.11(PL_next_solution+0x5940)
[0x7ffff7d0a7a0]
  [11] /home/wbk440/lib/swipl-7.1.11/lib/x86_64-linux/libswipl.so.7.1.11(+0x6f898)
[0x7ffff7d44898]
  [12] /home/wbk440/lib/swipl-7.1.11/lib/x86_64-linux/libswipl.so.7.1.11(+0xa3ed9)
[0x7ffff7d78ed9]
  [13] /lib64/libpthread.so.0() [0x32674079d1]
  [14] /lib64/libc.so.6(clone+0x6d) [0x32668e8b6d]
./run: line 33:  4525 Aborted                 (core dumped) $SWIPL -q
-f "$run" -- $*
~~~

---
Cheers,
Wouter Beek.

E-mail: [email protected]
WWW: www.wouterbeek.com
Tel.: 0647674624