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

* debug.h, debug.c: Various name changes.

(Mostly prefixing with SCM_.)  Renamed "debug-options" -->
"debug-options-interface".  See commentary in options.c.
This commit is contained in:
Mikael Djurfeldt 1996-08-23 01:19:03 +00:00
parent 80c78696e8
commit 5e8d7fd4fa
2 changed files with 82 additions and 76 deletions

View file

@ -27,53 +27,53 @@
/* {Run time control of the debugging evaluator}
*/
SCM_PROC (s_debug_options, "debug-options", 0, 1, 0, scm_debug_options);
SCM_PROC (s_debug_options, "debug-options-interface", 0, 1, 0, scm_debug_options);
#ifdef __STDC__
SCM
scm_debug_options (SCM new_values)
scm_debug_options (SCM setting)
#else
SCM
scm_debug_options (new_values)
SCM new_values;
scm_debug_options (setting)
SCM setting;
#endif
{
SCM ans;
SCM_DEFER_INTS;
ans = scm_change_options (new_values,
scm_debug_opts,
N_DEBUG_OPTIONS,
s_debug_options);
ans = scm_options (setting,
scm_debug_opts,
SCM_N_DEBUG_OPTIONS,
s_debug_options);
#ifndef SCM_RECKLESS
if (!(1 <= FRAMES && FRAMES <= MAXFRAMESIZE))
if (!(1 <= SCM_N_FRAMES && SCM_N_FRAMES <= SCM_MAX_FRAME_SIZE))
{
scm_change_options (ans, scm_debug_opts, N_DEBUG_OPTIONS, s_debug_options);
scm_options (ans, scm_debug_opts, SCM_N_DEBUG_OPTIONS, s_debug_options);
/* *fixme* Should SCM_ALLOW_INTS be called here? */
scm_wta (new_values, (char *) SCM_OUTOFRANGE, "frames");
scm_wta (setting, (char *) SCM_OUTOFRANGE, "frames");
}
#endif
RESET_DEBUG_MODE;
scm_debug_eframe_size = 2 * FRAMES;
SCM_RESET_DEBUG_MODE;
scm_debug_eframe_size = 2 * SCM_N_FRAMES;
SCM_ALLOW_INTS
return ans;
}
SCM_PROC (s_evaluator_traps, "evaluator-traps", 0, 1, 0, scm_evaluator_traps);
SCM_PROC (s_evaluator_traps, "evaluator-traps-interface", 0, 1, 0, scm_evaluator_traps);
#ifdef __STDC__
SCM
scm_evaluator_traps (SCM new_values)
scm_evaluator_traps (SCM setting)
#else
SCM
scm_evaluator_traps (new_values)
SCM new_values;
scm_evaluator_traps (setting)
SCM setting;
#endif
{
SCM ans;
SCM_DEFER_INTS;
ans = scm_change_options (new_values,
scm_evaluator_trap_table,
N_EVALUATOR_TRAPS,
s_evaluator_traps);
RESET_DEBUG_MODE;
ans = scm_options (setting,
scm_evaluator_trap_table,
SCM_N_EVALUATOR_TRAPS,
s_evaluator_traps);
SCM_RESET_DEBUG_MODE;
SCM_ALLOW_INTS
return ans;
}
@ -89,8 +89,8 @@ scm_single_step (val)
#endif
{
SCM_DEFER_INTS;
ENTER_FRAME = EXIT_FRAME = 1;
RESET_DEBUG_MODE;
SCM_ENTER_FRAME_P = SCM_EXIT_FRAME_P = 1;
SCM_RESET_DEBUG_MODE;
SCM_ALLOW_INTS;
scm_throw (cont, val);
return SCM_BOOL_F; /* never returns */
@ -403,9 +403,9 @@ _scm_stack_frame_to_plist (frame, offset)
{
int size;
scm_debug_info *info;
if (EVALFRAMEP (*frame))
if (SCM_EVALFRAMEP (*frame))
{
size = frame->status & MAXFRAMESIZE;
size = frame->status & SCM_MAX_FRAME_SIZE;
info = (scm_debug_info *) (*((SCM_STACKITEM **) &frame->vect[size]) + offset);
if ((info - frame->vect) & 1)
{
@ -419,7 +419,7 @@ _scm_stack_frame_to_plist (frame, offset)
info[1].a.proc,
scm_acons (scm_i_args,
info[1].a.args,
ARGSREADYP (*frame)
SCM_ARGS_READY_P (*frame)
? SCM_EOL
: scm_acons (scm_i_eval_args,
SCM_BOOL_T,
@ -484,7 +484,7 @@ scm_expr_stack (obj)
{
SCM frs = SCM_EOL, vfrs, p;
int size;
int max_vfrs = BACKTRACE_DEPTH;
int max_vfrs = SCM_BACKTRACE_DEPTH;
scm_debug_info *info;
scm_debug_frame *frame;
long offset = 0;
@ -509,16 +509,16 @@ scm_expr_stack (obj)
{
frame = (scm_debug_frame *) ((SCM_STACKITEM *) frame + offset);
p = _scm_stack_frame_to_plist (frame, offset);
if (EVALFRAMEP (*frame))
if (SCM_EVALFRAMEP (*frame))
{
size = frame->status & MAXFRAMESIZE;
size = frame->status & SCM_MAX_FRAME_SIZE;
info = (scm_debug_info *) (*((SCM_STACKITEM **) &frame->vect[size]) + offset);
vfrs = SCM_EOL;
if ((info - frame->vect) & 1)
--info;
/* Data in the apply part of an eval info frame comes from
previous stack frame if the scm_debug_info vector is overflowed. */
else if (OVERFLOWP (*frame)
else if (SCM_OVERFLOWP (*frame)
&& !SCM_UNBNDP (info[1].a.proc))
{
vfrs = scm_cons (p, SCM_EOL);
@ -530,7 +530,7 @@ scm_expr_stack (obj)
info -= 2;
vfrs = scm_cons (p, vfrs);
--max_vfrs;
if (OVERFLOWP (*frame))
if (SCM_OVERFLOWP (*frame))
vfrs = scm_cons (scm_i_more, vfrs);
while (info >= frame->vect)
{
@ -628,7 +628,7 @@ scm_lookup_cstr (str, len, env)
void
scm_init_debug ()
{
scm_init_opts (scm_debug_options, scm_debug_opts, N_DEBUG_OPTIONS);
scm_init_opts (scm_debug_options, scm_debug_opts, SCM_N_DEBUG_OPTIONS);
scm_tc16_memoized = scm_newsmob (&memoizedsmob);
scm_tc16_debugobj = scm_newsmob (&debugobjsmob);

View file

@ -63,43 +63,49 @@
/* {Options}
*/
/* scm_debug_opts and scm_evaluator_trap_table are defined in eval.c.
*/
extern scm_option scm_debug_opts[];
#define RECORD_PROCNAMES scm_debug_opts[0].val
#define DEBUG_EVAL scm_debug_opts[1].val
#define BREAKPOINTS scm_debug_opts[2].val
#define TRACE scm_debug_opts[3].val
#define BACKTRACE scm_debug_opts[4].val
#define BACKTRACE_DEPTH scm_debug_opts[5].val
#define FRAMES scm_debug_opts[6].val
#define CHEAPTRAPS scm_debug_opts[7].val
#define N_DEBUG_OPTIONS 8
#define SCM_CHEAPTRAPS_P scm_debug_opts[0].val
#define SCM_BREAKPOINTS_P scm_debug_opts[1].val
#define SCM_TRACE_P scm_debug_opts[2].val
#define SCM_REC_PROCNAMES_P scm_debug_opts[3].val
#define SCM_BACKWARDS_P scm_debug_opts[4].val
#define SCM_N_FRAMES scm_debug_opts[5].val
#define SCM_BACKTRACE_DEPTH scm_debug_opts[6].val
#define SCM_BACKTRACE_P scm_debug_opts[7].val
#define SCM_DEVAL_P scm_debug_opts[8].val
#define SCM_STACK_LIMIT scm_debug_opts[9].val
#define SCM_N_DEBUG_OPTIONS 10
extern scm_option scm_evaluator_trap_table[];
#define ENTER_FRAME scm_evaluator_trap_table[0].val
#define APPLY_FRAME scm_evaluator_trap_table[1].val
#define EXIT_FRAME scm_evaluator_trap_table[2].val
#define N_EVALUATOR_TRAPS 3
#define SCM_ENTER_FRAME_P scm_evaluator_trap_table[0].val
#define SCM_APPLY_FRAME_P scm_evaluator_trap_table[1].val
#define SCM_EXIT_FRAME_P scm_evaluator_trap_table[2].val
#define SCM_N_EVALUATOR_TRAPS 3
#ifdef __STDC__
extern SCM (*scm_ceval_ptr) (SCM exp, SCM env);
#else
extern SCM (*scm_ceval_ptr) ();
#endif
extern int debug_mode, check_entry, check_apply, check_exit;
extern int scm_debug_mode;
extern int scm_check_entry_p, scm_check_apply_p, scm_check_exit_p;
#define CHECK_ENTRY check_entry
#define CHECK_APPLY check_apply
#define CHECK_EXIT check_exit
#define CHECK_ENTRY scm_check_entry_p
#define CHECK_APPLY scm_check_apply_p
#define CHECK_EXIT scm_check_exit_p
#define RESET_DEBUG_MODE \
#define SCM_RESET_DEBUG_MODE \
{\
if (ENTER_FRAME || BREAKPOINTS) CHECK_ENTRY = 1;\
if (APPLY_FRAME || TRACE) CHECK_APPLY = 1;\
if (EXIT_FRAME || TRACE) CHECK_EXIT = 1;\
debug_mode = DEBUG_EVAL || BACKTRACE || CHECK_ENTRY || CHECK_APPLY || CHECK_EXIT;\
scm_ceval_ptr = debug_mode ? scm_deval : scm_ceval;\
if (SCM_ENTER_FRAME_P || SCM_BREAKPOINTS_P) CHECK_ENTRY = 1;\
if (SCM_APPLY_FRAME_P || SCM_TRACE_P) CHECK_APPLY = 1;\
if (SCM_EXIT_FRAME_P || SCM_TRACE_P) CHECK_EXIT = 1;\
scm_debug_mode = SCM_DEVAL_P || SCM_BACKTRACE_P || CHECK_ENTRY || CHECK_APPLY || CHECK_EXIT;\
scm_ceval_ptr = scm_debug_mode ? scm_deval : scm_ceval;\
}
@ -123,28 +129,28 @@ typedef struct scm_debug_frame
extern scm_debug_frame *last_debug_info_frame;
#define TAILREC (1L << 10)
#define TRACEDFRAME (1L << 9)
#define APPLYFRAME (1L << 8)
#define ARGSREADY (1L << 7)
#define DOVERFLOW (1L << 6)
#define MAXFRAMESIZE 63 /* also used as a mask for the size field */
#define SCM_TAILREC (1L << 10)
#define SCM_TRACED_FRAME (1L << 9)
#define SCM_APPLYFRAME (1L << 8)
#define SCM_ARGS_READY (1L << 7)
#define SCM_DOVERFLOW (1L << 6)
#define SCM_MAX_FRAME_SIZE 63 /* also used as a mask for the size field */
#define EVALFRAMEP(x) (((x).status & APPLYFRAME) == 0)
#define APPLYFRAMEP(x) (((x).status & APPLYFRAME) != 0)
#define OVERFLOWP(x) (((x).status & DOVERFLOW) != 0)
#define ARGSREADYP(x) (((x).status & ARGSREADY) != 0)
#define TRACEDFRAMEP(x) (((x).status & TRACEDFRAME) != 0)
#define TAILRECP(x) (((x).status & TAILREC) != 0)
#define SETOVERFLOW(x) ((x).status |= DOVERFLOW)
#define SETARGSREADY(x) ((x).status |= ARGSREADY)
#define CLEARARGSREADY(x) ((x).status &= ~ARGSREADY)
#define SETTRACEDFRAME(x) ((x).status |= TRACEDFRAME)
#define CLEARTRACEDFRAME(x) ((x).status &= ~TRACEDFRAME)
#define SETTAILREC(x) ((x).status |= TAILREC)
#define SCM_EVALFRAMEP(x) (((x).status & SCM_APPLYFRAME) == 0)
#define SCM_APPLYFRAMEP(x) (((x).status & SCM_APPLYFRAME) != 0)
#define SCM_OVERFLOWP(x) (((x).status & SCM_DOVERFLOW) != 0)
#define SCM_ARGS_READY_P(x) (((x).status & SCM_ARGS_READY) != 0)
#define SCM_TRACED_FRAME_P(x) (((x).status & SCM_TRACED_FRAME) != 0)
#define SCM_TAILRECP(x) (((x).status & SCM_TAILREC) != 0)
#define SCM_SET_OVERFLOW(x) ((x).status |= SCM_DOVERFLOW)
#define SCM_SET_ARGSREADY(x) ((x).status |= SCM_ARGS_READY)
#define SCM_CLEAR_ARGSREADY(x) ((x).status &= ~SCM_ARGS_READY)
#define SCM_SET_TRACED_FRAME(x) ((x).status |= SCM_TRACED_FRAME)
#define SCM_CLEAR_TRACED_FRAME(x) ((x).status &= ~SCM_TRACED_FRAME)
#define SCM_SET_TAILREC(x) ((x).status |= SCM_TAILREC)
#define DEBUGGINGP debug_mode
#define DSIDEVAL(x, env) if NIMP(x) scm_deval((x), (env))
#define SCM_DEBUGGINGP scm_debug_mode
#define SCM_DSIDEVAL(x, env) if NIMP(x) scm_deval((x), (env))
/* {Memoized Source}
*/