1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

better narrowing in catch-all handlers in throw.c

* libguile/throw.c (handler_message): Narrow away the catch-closure and
  throw frames.
This commit is contained in:
Andy Wingo 2011-02-11 15:30:25 +01:00
parent 9179e8a5ff
commit 39d41afe18

View file

@ -353,7 +353,13 @@ handler_message (void *handler_data, SCM tag, SCM args)
SCM p, stack, frame;
p = scm_current_error_port ();
stack = scm_make_stack (SCM_BOOL_T, SCM_EOL);
/* Usually we get here via a throw to a catch-all. In that case
there is the throw frame active, and the catch closure, so narrow by
two frames. It is possible for a user to invoke
scm_handle_by_message directly, though, so it could be this
narrows too much. We'll have to see how this works out in
practice. */
stack = scm_make_stack (SCM_BOOL_T, scm_list_1 (scm_from_int (2)));
frame = scm_is_true (stack) ? scm_stack_ref (stack, SCM_INUM0) : SCM_BOOL_F;
if (should_print_backtrace (tag, stack))