summaryrefslogtreecommitdiffstats
path: root/unwind.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-26 06:56:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-26 06:56:04 -0700
commitea81292fa7d10df029d1e938e086bed648ab1120 (patch)
treeb022196267784a5ae3e0717fab206eab1fc20e4b /unwind.h
parentc2d87ddcd9e18d7088448533ba8203cd9a8a042e (diff)
downloadtxr-ea81292fa7d10df029d1e938e086bed648ab1120.tar.gz
txr-ea81292fa7d10df029d1e938e086bed648ab1120.tar.bz2
txr-ea81292fa7d10df029d1e938e086bed648ab1120.zip
Let guard frames optionally pass through unwinding.
We have a bug in that when an exception occurs in a context called from obj_print, the guard for stopping continuation captures across obj_print also unintentially blocks the unwinding. Let's make the unwinding blockage optional * unwind.c (uw_unwind_to_exit_point): If a UW_GUARD is encountered, do not abort if the uw_ok flag is set; keep unwinding. (uw_push_guard): New uw_ok argument, initializes the uw_ok member of a guard frame. * unwind.h (struct uw_guard): New struct type. (union uw_frame): New member gu of type struct uw_guard. (uw_push_guard): Declaration updated. * ftw.c (ftw_callback): Pass zero as new uw_push_guard argument: no unwinding across the POSIX library function ftw. * glob.c (errfunc_thunk): Likewise, no unwinding across the library function glob. * lib.c (obj_print): Pass 1 as new uw_push_guard argument: continuations can't be captured, but unwinding is okay.
Diffstat (limited to 'unwind.h')
-rw-r--r--unwind.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/unwind.h b/unwind.h
index 7177f0b1..20e3c987 100644
--- a/unwind.h
+++ b/unwind.h
@@ -79,6 +79,12 @@ struct uw_cont_copy {
void (*copy)(mem_t *ptr, int parent);
};
+struct uw_guard {
+ uw_frame_t *up;
+ uw_frtype_t type;
+ int uw_ok;
+};
+
struct uw_debug {
uw_frame_t *up;
uw_frtype_t type;
@@ -98,6 +104,7 @@ union uw_frame {
struct uw_catch ca;
struct uw_handler ha;
struct uw_cont_copy cp;
+ struct uw_guard gu;
struct uw_debug db;
};
@@ -124,7 +131,7 @@ noreturn val uw_errorfv(val fmt, struct args *args);
val uw_register_subtype(val sub, val super);
val uw_exception_subtype_p(val sub, val sup);
void uw_continue(uw_frame_t *target);
-void uw_push_guard(uw_frame_t *);
+void uw_push_guard(uw_frame_t *, int uw_ok);
void uw_push_debug(uw_frame_t *, val func, struct args *,
val ub_p_a_pairs, val env, val data,
val line, val chr);