瀏覽代碼

In G_fatal_error(): raise SIGSEGV if environment variable GRASS_SIGSEGV_ON_ERROR is set.

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40532 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 15 年之前
父節點
當前提交
83307b0a64
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      lib/gis/error.c

+ 8 - 1
lib/gis/error.c

@@ -17,10 +17,10 @@
 #include <unistd.h>
 #include <unistd.h>
 #include <time.h>
 #include <time.h>
 #include <stdarg.h>
 #include <stdarg.h>
+#include <signal.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <grass/glocale.h>
 #include <grass/glocale.h>
 #include <grass/gis.h>
 #include <grass/gis.h>
-
 /*!
 /*!
  * \def MSG
  * \def MSG
  *
  *
@@ -159,6 +159,13 @@ void G_fatal_error(const char *msg, ...)
 
 
     G__call_error_handlers();
     G__call_error_handlers();
 
 
+    /* Raise SIGSEGV, useful for debugging only.
+     * Type "export GRASS_SIGSEGV_ON_ERROR=1"
+     * to enable this feature using bash.
+     */
+    if (getenv("GRASS_SIGSEGV_ON_ERROR"))
+        raise(SIGSEGV);
+
     exit(EXIT_FAILURE);
     exit(EXIT_FAILURE);
 }
 }