From 70baba940fb33e1016ed8d5370bc524410b83a52 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sat, 13 Sep 2008 12:08:16 +0000 Subject: 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 --- crawl-ref/source/AppHdr.h | 5 +++++ crawl-ref/source/libunix.cc | 13 +++++++++++++ 2 files changed, 18 insertions(+) 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 +#include +#endif + #ifdef UNICODE_GLYPHS #include #include @@ -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(); -- cgit v1.2.3-54-g00ecf