diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-01-21 17:26:53 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-01-21 17:26:53 -0800 |
commit | e2118a041353a9d85e1c56051335f8ac0df101fd (patch) | |
tree | f4501d9a9f82eba38a75e4f9f666e46a659c61d0 | |
parent | 0cbd46033d0ef707a856c78e735dbf41a6fd7faa (diff) | |
download | txr-e2118a041353a9d85e1c56051335f8ac0df101fd.tar.gz txr-e2118a041353a9d85e1c56051335f8ac0df101fd.tar.bz2 txr-e2118a041353a9d85e1c56051335f8ac0df101fd.zip |
* debug.c (help): Added missing help for w command.
(debug): In backtrace, show the renaming pairs for unbound
variables (up_p_a_pairs) if they are present.
* debug.h (debug_begin): Renamed to debug_frame.
* eval.c (eval): Wrap debug_begin/debug_end around function dispatch,
so TXR Lisp functions are included in backtraces.
* match.c (h_fun): Follow rename of debug_begin to debug_frame.
Pass in evaluated args, not the original ones.
(v_fun): Likewise.
* unwind.c (uw_push_debug): bindings argument renamed to env.
Bugfix: args argument was being assigned to ub_p_a_pairs.
* unwind.h (struct uw_debug): Member bindings renamed to env.
(uw_push_debug): Declaration updated.
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | debug.c | 10 | ||||
-rw-r--r-- | debug.h | 6 | ||||
-rw-r--r-- | eval.c | 7 | ||||
-rw-r--r-- | match.c | 4 | ||||
-rw-r--r-- | unwind.c | 6 | ||||
-rw-r--r-- | unwind.h | 4 |
7 files changed, 43 insertions, 15 deletions
@@ -1,5 +1,26 @@ 2012-01-21 Kaz Kylheku <kaz@kylheku.com> + * debug.c (help): Added missing help for w command. + (debug): In backtrace, show the renaming pairs for unbound + variables (up_p_a_pairs) if they are present. + + * debug.h (debug_begin): Renamed to debug_frame. + + * eval.c (eval): Wrap debug_begin/debug_end around function dispatch, + so TXR Lisp functions are included in backtraces. + + * match.c (h_fun): Follow rename of debug_begin to debug_frame. + Pass in evaluated args, not the original ones. + (v_fun): Likewise. + + * unwind.c (uw_push_debug): bindings argument renamed to env. + Bugfix: args argument was being assigned to ub_p_a_pairs. + + * unwind.h (struct uw_debug): Member bindings renamed to env. + (uw_push_debug): Declaration updated. + +2012-01-21 Kaz Kylheku <kaz@kylheku.com> + * debug.c (last_command): Do not initialize with lit(); this is not a constant expression in C. (debug): Handle the situation here. @@ -31,7 +31,8 @@ static void help(val stream) "c - continue f - finish form\n" "v - show variable binding environment s - show current form\n" "b - set breakpoint by line number i - show current data\n" - "d - delete breakpoint l - list breakpoints\n")); + "d - delete breakpoint w - backtrace\n" + "l - list breakpoints\n")); } static void show_bindings(val env, val stream) @@ -143,7 +144,12 @@ val debug(val form, val bindings, val data, val line, val chr) for (iter = uw_current_frame(); iter != 0; iter = iter->uw.up) { if (iter->uw.type == UW_DBG) { - format(std_output, lit("(~s ~s)\n"), iter->db.func, iter->db.args, nao); + if (iter->db.ub_p_a_pairs) + format(std_output, lit("(~s ~s ~s)\n"), iter->db.func, + iter->db.args, iter->db.ub_p_a_pairs, nao); + else + format(std_output, lit("(~s ~s)\n"), iter->db.func, + iter->db.args, nao); } } } @@ -30,7 +30,7 @@ extern val debug_block_s; val debug(val form, val bindings, val data, val line, val chr); -#ifdef CONFIG_DEBUG_SUPPORT +#if CONFIG_DEBUG_SUPPORT #define debug_enter \ { \ @@ -58,7 +58,7 @@ INLINE val debug_check(val form, val bindings, val data, val line, val chr) void debug_init(void); -#define debug_begin(FUNC, ARGS, UBP, \ +#define debug_frame(FUNC, ARGS, UBP, \ BINDINGS, DATA, \ LINE, CHR) \ do { \ @@ -89,7 +89,7 @@ INLINE val debug_check(val form, val bindings, val data, val line, val chr) return nil; } -#define debug_begin(FUNC, ARGS, UBP, \ +#define debug_frame(FUNC, ARGS, UBP, \ BINDINGS, DATA, \ LINE, CHR) \ do { \ @@ -353,9 +353,10 @@ val eval(val form, val env, val ctx_form) val fbinding = lookup_fun(env, oper); if (fbinding) { - debug_return (apply(cdr(fbinding), - eval_args(rest(form), env, form), - form)); + val args = eval_args(rest(form), env, form); + debug_frame(oper, args, nil, env, nil, nil, nil); + debug_return (apply(cdr(fbinding), args, form)); + debug_end; } else { val entry = gethash(op_table, oper); @@ -1021,7 +1021,7 @@ static val h_fun(match_line_ctx c, match_line_ctx *cout) { uw_block_begin(nil, result); uw_env_begin; - debug_begin(sym, args, ub_p_a_pairs, c.bindings, c.dataline, c.data_lineno, c.pos); + debug_frame(sym, bindings_cp, ub_p_a_pairs, c.bindings, c.dataline, c.data_lineno, c.pos); result = match_line(ml_bindings_specline(c, bindings_cp, body)); @@ -3268,7 +3268,7 @@ static val v_fun(match_files_ctx *c) { uw_block_begin(nil, result); uw_env_begin; - debug_begin(sym, args, ub_p_a_pairs, c->bindings, if2(consp(c->data), car(c->data)), + debug_frame(sym, bindings_cp, ub_p_a_pairs, c->bindings, if2(consp(c->data), car(c->data)), c->data_lineno, nil); result = match_files(mf_spec_bindings(*c, body, bindings_cp)); debug_end; @@ -158,14 +158,14 @@ val uw_set_match_context(val context) } void uw_push_debug(uw_frame_t *fr, val func, val args, - val ub_p_a_pairs, val bindings, val data, + val ub_p_a_pairs, val env, val data, val line, val chr) { fr->db.type = UW_DBG; fr->db.func = func; fr->db.args = args; - fr->db.ub_p_a_pairs = args; - fr->db.bindings = bindings; + fr->db.ub_p_a_pairs = ub_p_a_pairs; + fr->db.env = env; fr->db.data = data; fr->db.line = line; fr->db.chr = chr; @@ -71,7 +71,7 @@ struct uw_debug { val func; val args; val ub_p_a_pairs; - val bindings; + val env; val data; val line; val chr; @@ -100,7 +100,7 @@ val uw_register_subtype(val sub, val super); val uw_exception_subtype_p(val sub, val sup); void uw_continue(uw_frame_t *curr, uw_frame_t *target); void uw_push_debug(uw_frame_t *, val func, val args, - val ub_p_a_pairs, val bindings, val data, + val ub_p_a_pairs, val env, val data, val line, val chr); void uw_pop_frame(uw_frame_t *); uw_frame_t *uw_current_frame(void); |