dump stack on YAP bug (maybe extend to user foreign code).
This commit is contained in:
parent
b7ee47ce46
commit
1c68deb663
17
C/errors.c
17
C/errors.c
@ -27,6 +27,9 @@
|
|||||||
#if HAVE_STRING_H
|
#if HAVE_STRING_H
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if HAVE_EXECINFO_H
|
||||||
|
#include <execinfo.h>
|
||||||
|
#endif
|
||||||
#include "Foreign.h"
|
#include "Foreign.h"
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
@ -480,8 +483,22 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
fprintf(stderr, "%% YAP crashed while booting %s\n", tmpbuf);
|
fprintf(stderr, "%% YAP crashed while booting %s\n", tmpbuf);
|
||||||
} else {
|
} else {
|
||||||
Yap_detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, YAP_BUF_SIZE);
|
Yap_detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, YAP_BUF_SIZE);
|
||||||
|
if (tmpbuf[0]) {
|
||||||
fprintf(stderr, "%% Bug found while executing %s\n", tmpbuf);
|
fprintf(stderr, "%% Bug found while executing %s\n", tmpbuf);
|
||||||
}
|
}
|
||||||
|
#if HAVE_BACKTRACE
|
||||||
|
void *callstack[256];
|
||||||
|
int i;
|
||||||
|
int frames = backtrace(callstack, 256);
|
||||||
|
char** strs = backtrace_symbols(callstack, frames);
|
||||||
|
fprintf(stderr, "Execution stack:\n");
|
||||||
|
for (i = 0; i < frames; ++i) {
|
||||||
|
fprintf(stderr, " %s\n", strs[i]);
|
||||||
|
|
||||||
|
}
|
||||||
|
free(strs);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
error_exit_yap(1);
|
error_exit_yap(1);
|
||||||
}
|
}
|
||||||
case SYSTEM_ERROR_FATAL: {
|
case SYSTEM_ERROR_FATAL: {
|
||||||
|
@ -192,6 +192,7 @@ check_function_exists( access HAVE_ACCESS )
|
|||||||
check_function_exists( acosh HAVE_ACOSH )
|
check_function_exists( acosh HAVE_ACOSH )
|
||||||
check_function_exists( asinh HAVE_ASINH )
|
check_function_exists( asinh HAVE_ASINH )
|
||||||
check_function_exists( atanh HAVE_ATANH )
|
check_function_exists( atanh HAVE_ATANH )
|
||||||
|
check_function_exists( backtrace HAVE_BACKTRACE )
|
||||||
check_function_exists( basename HAVE_BASENAME )
|
check_function_exists( basename HAVE_BASENAME )
|
||||||
check_function_exists( chdir HAVE_CHDIR )
|
check_function_exists( chdir HAVE_CHDIR )
|
||||||
check_function_exists(_chsize_s HAVE__CHSIZE_S)
|
check_function_exists(_chsize_s HAVE__CHSIZE_S)
|
||||||
|
115
config.h.cmake
115
config.h.cmake
@ -246,6 +246,11 @@ function. */
|
|||||||
#cmakedefine HAVE_BASENAME ${HAVE_BASENAME}
|
#cmakedefine HAVE_BASENAME ${HAVE_BASENAME}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `basename' function. */
|
||||||
|
#ifndef HAVE_BACKTRACE
|
||||||
|
#cmakedefine HAVE_BACKTRACE ${HAVE_BACKTRACE}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define to 1 if you have the `chdir' function. */
|
/* Define to 1 if you have the `chdir' function. */
|
||||||
#ifndef HAVE_CHDIR
|
#ifndef HAVE_CHDIR
|
||||||
#cmakedefine HAVE_CHDIR ${HAVE_CHDIR}
|
#cmakedefine HAVE_CHDIR ${HAVE_CHDIR}
|
||||||
@ -531,115 +536,7 @@ function. */
|
|||||||
#cmakedefine HAVE_GLOB ${HAVE_GLOB}
|
#cmakedefine HAVE_GLOB ${HAVE_GLOB}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `gmtime' function. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*q Define to 1 if you have the `gmtime' function. */
|
|
||||||
#ifndef HAVE_GMTIME
|
#ifndef HAVE_GMTIME
|
||||||
#cmakedefine HAVE_GMTIME ${HAVE_GMTIME}
|
#cmakedefine HAVE_GMTIME ${HAVE_GMTIME}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user