summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-03-12 06:26:39 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-03-12 06:26:39 -0700
commitd7da2bfe648831812d1524bc9ee9c2ed86b4bc2a (patch)
tree3bcadd6339163745c3046ddec8e39c84c9d60597
parentdc8d4daad16f42ad5bfce98d8614643ed42efa34 (diff)
downloadtxr-d7da2bfe648831812d1524bc9ee9c2ed86b4bc2a.tar.gz
txr-d7da2bfe648831812d1524bc9ee9c2ed86b4bc2a.tar.bz2
txr-d7da2bfe648831812d1524bc9ee9c2ed86b4bc2a.zip
unwind: better debugging of exceptions.
Once upon a time when we didn't have continuable warning exceptions, it was easy to debug internal error throws in TXR: just set a breakpoint on uw_throw and catch it in the debugger. This approach became unworkable with uw_throw being executed numerous times as part of the ordinary program control flow. With this change, we get that debugging experience back. * unwind.c (uw_break_on_error): New static variable. (uw_throw): If the break-on-error variable is set and we are processing an exception derived from error, then call the breakpt function.
-rw-r--r--unwind.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/unwind.c b/unwind.c
index c1e5ba26..0032493d 100644
--- a/unwind.c
+++ b/unwind.c
@@ -65,6 +65,10 @@ static val frame_type, catch_frame_type, handle_frame_type;
static val deferred_warnings, tentative_defs;
+#if CONFIG_EXTRA_DEBUGGING
+static int uw_break_on_error;
+#endif
+
/* C99 inline instantiations. */
#if __STDC_VERSION__ >= 199901L
val uw_block_return(val tag, val result);
@@ -555,6 +559,11 @@ val uw_throw(val sym, val args)
abort();
}
+#if CONFIG_EXTRA_DEBUGGING
+ if (uw_break_on_error && uw_exception_subtype_p(sym, error_s))
+ breakpt();
+#endif
+
if (!listp(args))
args = cons(args, nil);