Mercurial > hg > xemacs-beta
diff src/print.c @ 4880:ae81a2c00f4f
try harder to avoid crashing when debug-printing
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-01-18 Ben Wing <ben@xemacs.org>
* lisp.h:
* print.c:
New variable `in_debug_print'.
* alloc.c:
* alloc.c (free_managed_lcrecord):
If gc_in_progress and in_debug_print, just return instead of
crashing. This only happens when the programmer calls debug_print()
or a variation inside of a debugger, and is probably already
diagnosing a crash.
* print.c (struct debug_bindings):
* print.c (debug_prin1_exit):
* print.c (debug_prin1):
At entrance, record the old value of in_debug_print in the
debug_bindings, set up an unwind-protect to restore the old value,
and set in_debug_print to 1. In the unwind-protect, restore the
old value.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Mon, 18 Jan 2010 06:05:21 -0600 |
parents | 05c519de7353 |
children | 19a72041c5ed |
line wrap: on
line diff
--- a/src/print.c Sat Jan 16 06:50:01 2010 -0600 +++ b/src/print.c Mon Jan 18 06:05:21 2010 -0600 @@ -114,6 +114,9 @@ /* Force immediate output of all printed data. Used for debugging. */ int print_unbuffered; +/* Non-zero if in debug-printing */ +int in_debug_print; + FILE *termscript; /* Stdio stream being used for copy of all output. */ static void write_string_to_alternate_debugging_output (const Ibyte *str, @@ -127,6 +130,7 @@ int print_depth; int print_readably; int print_unbuffered; + int in_debug_print; int gc_currently_forbidden; Lisp_Object Vprint_length; Lisp_Object Vprint_level; @@ -2243,6 +2247,7 @@ print_depth = bindings->print_depth; print_readably = bindings->print_readably; print_unbuffered = bindings->print_unbuffered; + in_debug_print = bindings->in_debug_print; gc_currently_forbidden = bindings->gc_currently_forbidden; Vprint_length = bindings->Vprint_length; Vprint_level = bindings->Vprint_level; @@ -2270,6 +2275,7 @@ bindings->print_depth = print_depth; bindings->print_readably = print_readably; bindings->print_unbuffered = print_unbuffered; + bindings->in_debug_print = in_debug_print; bindings->gc_currently_forbidden = gc_currently_forbidden; bindings->Vprint_length = Vprint_length; bindings->Vprint_level = Vprint_level; @@ -2280,6 +2286,8 @@ print_depth = 0; print_readably = debug_print_readably != -1 ? debug_print_readably : 0; print_unbuffered++; + in_debug_print = 1; + gc_currently_forbidden = 1; if (debug_print_length > 0) Vprint_length = make_int (debug_print_length); if (debug_print_level > 0)