aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert2012-09-04 11:29:04 -0700
committerPaul Eggert2012-09-04 11:29:04 -0700
commitcf29dd84d205e1c78fed5d1ea0006a382658598c (patch)
tree7e6806fdd94ef53cda78db6b29a4df0276408eb4 /src/alloc.c
parent972debf2e7381b4fd2c70f9c1fd585d8bd137917 (diff)
downloademacs-cf29dd84d205e1c78fed5d1ea0006a382658598c.tar.gz
emacs-cf29dd84d205e1c78fed5d1ea0006a382658598c.zip
Give more-useful info on a fatal error (Bug#12328).
* doc/emacs/trouble.texi (Crashing): New section, documenting this. * etc/NEWS: Document the change. * src/alloc.c [ENABLE_CHECKING]: Do not include <execinfo.h>. (die) [ENABLE_CHECKING]: Call fatal_error_backtrace instead of doing the work ourselves. * src/emacs.c (fatal_error_signal): Let fatal_error_backtrace do most of the work. (fatal_error_backtrace): New function, taken from the guts of the old fatal_error_signal, but with a new option to output a backtrace. (shut_down_emacs) [!DOS_NT]: Use strsignal to give more-useful info about the signal than just its number. * src/lisp.h (fatal_error_backtrace, emacs_backtrace): New decls. * src/sysdep.c: Include <execinfo.h> (emacs_backtrace): New function, taken partly from the previous code of the 'die' function. (emacs_abort): Call fatal_error_backtrace rather than abort.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 2a831cea62a..157d3a1d799 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6685,21 +6685,14 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max)
6685 6685
6686#ifdef ENABLE_CHECKING 6686#ifdef ENABLE_CHECKING
6687 6687
6688# include <execinfo.h>
6689
6690bool suppress_checking; 6688bool suppress_checking;
6691 6689
6692void 6690void
6693die (const char *msg, const char *file, int line) 6691die (const char *msg, const char *file, int line)
6694{ 6692{
6695 enum { NPOINTERS_MAX = 500 };
6696 void *buffer[NPOINTERS_MAX];
6697 int npointers;
6698 fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", 6693 fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n",
6699 file, line, msg); 6694 file, line, msg);
6700 npointers = backtrace (buffer, NPOINTERS_MAX); 6695 fatal_error_backtrace (SIGABRT, INT_MAX);
6701 backtrace_symbols_fd (buffer, npointers, STDERR_FILENO);
6702 emacs_abort ();
6703} 6696}
6704#endif 6697#endif
6705 6698