diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-13 12:08:16 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-13 12:08:16 +0000 |
commit | 70baba940fb33e1016ed8d5370bc524410b83a52 (patch) | |
tree | cb713af9d77af347bbdd24b7ec24665cd2b507a3 | |
parent | 07d376f8e8884020c0ba45ad76bb419d2d89b600 (diff) | |
download | crawl-ref-70baba940fb33e1016ed8d5370bc524410b83a52.tar.gz crawl-ref-70baba940fb33e1016ed8d5370bc524410b83a52.zip |
Trunk->0.4 r6912: Enable core dumps automatically for dgamelaunch builds (-DDGL_ENABLE_CORE_DUMP) to make it easier to track down crashes.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@6913 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/AppHdr.h | 5 | ||||
-rw-r--r-- | crawl-ref/source/libunix.cc | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/crawl-ref/source/AppHdr.h b/crawl-ref/source/AppHdr.h index 3a1fb6c7b2..0416da3b05 100644 --- a/crawl-ref/source/AppHdr.h +++ b/crawl-ref/source/AppHdr.h @@ -272,6 +272,11 @@ // an error message. #define DGL_PAUSE_AFTER_ERROR + // Enable core dumps. Note that this will not create core dumps if + // Crawl is installed setuid or setgid, but dgamelaunch installs should + // not be installing Crawl set[ug]id anyway. + #define DGL_ENABLE_CORE_DUMP + // Use UTC for dgamelaunch servers. #define TIME_FN gmtime #endif diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc index cd84a7a282..b79b7da691 100644 --- a/crawl-ref/source/libunix.cc +++ b/crawl-ref/source/libunix.cc @@ -51,6 +51,11 @@ #include "stuff.h" #include "view.h" +#ifdef DGL_ENABLE_CORE_DUMP +#include <sys/time.h> +#include <sys/resource.h> +#endif + #ifdef UNICODE_GLYPHS #include <wchar.h> #include <locale.h> @@ -447,6 +452,14 @@ void unixcurses_startup( void ) #endif +#ifdef DGL_ENABLE_CORE_DUMP + rlimit lim; + if (!getrlimit(RLIMIT_CORE, &lim)) { + lim.rlim_cur = RLIM_INFINITY; + setrlimit(RLIMIT_CORE, &lim); + } +#endif + initscr(); raw(); noecho(); |