summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2017-12-20 12:06:54 -0800
committerH. Peter Anvin <hpa@linux.intel.com>2017-12-20 12:10:33 -0800
commitdcbaf677d4b5118d427a3a3b45a3499e22fa8635 (patch)
tree71eed113210236784c1ba17d4a070b753ecd6f70
parent7a6bf74d025fa6c961e4fc8292330f09f2be2778 (diff)
downloadnasm-dcbaf677d4b5118d427a3a3b45a3499e22fa8635.tar.gz
error: add --enable-panic-abort config options
For debugging purposes, make it possible to force calling abort() on ERR_PANIC. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--asm/nasm.c4
-rw-r--r--configure.ac7
2 files changed, 10 insertions, 1 deletions
diff --git a/asm/nasm.c b/asm/nasm.c
index fd4a8c3c..dc97c176 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -1829,7 +1829,9 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args)
break; /* placate silly compilers */
case ERR_PANIC:
fflush(NULL);
- /* abort(); */ /* halt, catch fire, and dump core */
+#ifdef ABORT_ON_PANIC
+ abort(); /* halt, catch fire, dump core/stop debugger */
+#endif
if (ofile) {
fclose(ofile);
remove(outname);
diff --git a/configure.ac b/configure.ac
index 3c344abd..071b043c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,6 +43,13 @@ AS_IF([test x"$pa_init_cflags" = x],
AS_IF([test x"$pa_optimize" = "x-O0"],
[PA_ADD_CFLAGS([-fno-omit-frame-pointer])])
+dnl Abort on panic
+PA_ARG_ENABLED([panic-abort],
+ [call abort() on panic to trap in the debugger],
+ [AC_DEFINE(ABORT_ON_PANIC)])
+AH_TEMPLATE(ABORT_ON_PANIC,
+[Define to 1 to call abort() on panics (internal errors), for debugging.])
+
dnl Check for library extension
PA_LIBEXT