From 608924d13f5b858549970037873f52e7d0c51774 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 14 Jun 2021 22:48:28 -0700 Subject: unwind: unbind dyn env when diagnosing unhandled exception. * unwind.c (uw_unwind_to_exit_point): The error reporting relies on the *stderr* stream, but that stream may be bound in some funny way in a context where an exception has happened, without anything around it to restore that during unwinding. Before diagnosing, we should reset the dynamic environment to the top level, so that the global values of all dynamic variables are revealed. --- unwind.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unwind.c b/unwind.c index c0516979..3cb47a9a 100644 --- a/unwind.c +++ b/unwind.c @@ -120,6 +120,8 @@ static void uw_unwind_to_exit_point(void) val sym = unhandled_ex.ca.sym; val args = unhandled_ex.ca.args; + dyn_env = nil; + if (opt_loglevel >= 1) { val prefix = scat2(prog_string, lit(":")); -- cgit v1.2.3