/* Debugging extensions for Guile
- * Copyright (C) 1995, 1996, 1997 Free Software Foundation
+ * Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <stdio.h>
#include "_scm.h"
#include "eval.h"
+#include "stackchk.h"
#include "throw.h"
#include "genio.h"
+#include "macros.h"
#include "smob.h"
#include "procprop.h"
#include "srcprop.h"
#include "strports.h"
#include "read.h"
#include "feature.h"
+#include "dynwind.h"
#include "debug.h"
\f
}
#endif
SCM_RESET_DEBUG_MODE;
+ scm_stack_checking_enabled_p = SCM_STACK_CHECKING_P;
scm_debug_eframe_size = 2 * SCM_N_FRAMES;
SCM_ALLOW_INTS
return ans;
}
-SCM_PROC (s_single_step, "single-step", 2, 0, 0, scm_single_step);
+SCM_PROC (s_with_traps, "with-traps", 1, 0, 0, scm_with_traps);
+
+static void
+with_traps_before (void *data)
+{
+ int *trap_flag = data;
+ *trap_flag = SCM_TRAPS_P;
+ SCM_TRAPS_P = 1;
+}
+
+static void
+with_traps_after (void *data)
+{
+ int *trap_flag = data;
+ SCM_TRAPS_P = *trap_flag;
+}
+
+static SCM
+with_traps_inner (void *data)
+{
+ SCM thunk = (SCM) data;
+ return scm_apply (thunk, SCM_EOL, SCM_EOL);
+}
SCM
-scm_single_step (cont, val)
- SCM cont;
- SCM val;
+scm_with_traps (SCM thunk)
{
- SCM_DEFER_INTS;
- SCM_ENTER_FRAME_P = SCM_EXIT_FRAME_P = 1;
- SCM_RESET_DEBUG_MODE;
- SCM_ALLOW_INTS;
- scm_call_continuation (cont, val);
- return SCM_BOOL_F; /* never returns */
+ int trap_flag;
+ SCM_ASSERT (SCM_NFALSEP (scm_thunk_p (thunk)),
+ thunk,
+ SCM_ARG1,
+ s_with_traps);
+ return scm_internal_dynamic_wind (with_traps_before,
+ with_traps_inner,
+ with_traps_after,
+ (void *) thunk,
+ &trap_flag);
}
\f
vframe.vect = &vframe_vect_body;
vframe.vect[0].id = id;
scm_last_debug_frame = &vframe;
- answer = scm_eval_3 (exp, 0, env);
+ answer = scm_eval_3 (exp, 1, env);
scm_last_debug_frame = vframe.prev;
return answer;
}
static char s_start_stack[] = "start-stack";
-SCM
+static SCM
scm_m_start_stack (exp, env)
SCM exp;
SCM env;