diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-18 06:09:54 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-18 06:09:54 +0000 |
commit | c4aac587234c1eebad7fb400de5486a5ac73cd38 (patch) | |
tree | 29584db5e66272a3e5a39e5fed95c94180f42ef9 /crawl-ref/source/libunix.cc | |
parent | d95060f1e6fa1e397bc95ea43c239b3019e3fb2f (diff) | |
download | crawl-ref-c4aac587234c1eebad7fb400de5486a5ac73cd38.tar.gz crawl-ref-c4aac587234c1eebad7fb400de5486a5ac73cd38.zip |
When dumping info upon a crash:
* For Unix builds, shut down curses in case the crash reporter can't
open up a file and has to dump the crash directly to stderr.
* Include all saved messages in the crash report.
* Use EOL instead of \n or \r\n.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8535 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/libunix.cc')
-rw-r--r-- | crawl-ref/source/libunix.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc index c4ef372837..f8f8acb1a5 100644 --- a/crawl-ref/source/libunix.cc +++ b/crawl-ref/source/libunix.cc @@ -1151,7 +1151,7 @@ static void _crash_signal_handler(int sig_num) { if (crawl_state.game_crashed) { - fprintf(stderr, "Recursive crash.\n"); + fprintf(stderr, "Recursive crash." EOL); std::string dir = (!Options.morgue_dir.empty() ? Options.morgue_dir : !SysEnv.crawl_dir.empty() ? SysEnv.crawl_dir @@ -1180,6 +1180,10 @@ static void _crash_signal_handler(int sig_num) _crash_signal = sig_num; crawl_state.game_crashed = true; + // In case the crash dumper is unable to open a file and has to dump + // to stderr. + unixcurses_shutdown(); + do_crash_dump(); // Now crash for real. @@ -1240,7 +1244,7 @@ void dump_crash_info(FILE* file) if (name == NULL) name = "INVALID"; - fprintf(file, "Crash caused by signal #%d: %s\r\n", _crash_signal, + fprintf(file, "Crash caused by signal #%d: %s" EOL, _crash_signal, name); } @@ -1258,8 +1262,8 @@ void write_stack_trace(FILE* file, int ignore_count) if (symbols == NULL) { - fprintf(stderr, "Out of memroy.\r\n"); - fprintf(file, "Out of memory.\r\n"); + fprintf(stderr, "Out of memroy." EOL); + fprintf(file, "Out of memory." EOL); // backtrace_symbols_fd() can print out the stack trace even if // malloc() can't find any free memory. @@ -1269,7 +1273,7 @@ void write_stack_trace(FILE* file, int ignore_count) for (int i = ignore_count; i < num_frames; i++) { - fprintf(file, "%s\r\n", symbols[i]); + fprintf(file, "%s" EOL, symbols[i]); } free(symbols); @@ -1277,7 +1281,7 @@ void write_stack_trace(FILE* file, int ignore_count) #else // ifdef __GLIBC__ void write_stack_trace(FILE* file, int ignore_count) { - const char* msg = "Unable to get stack trace on this platform.\n"; + const char* msg = "Unable to get stack trace on this platform." EOL; fprintf(stderr, msg); fprintf(file, msg); } |