summaryrefslogtreecommitdiffstats
path: root/cadr.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-04-29 06:48:00 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-04-29 06:48:00 -0700
commit06d0ada8a9ff7078f8ab89d5b4ce36f04587dc62 (patch)
treea1a2ce6b398183fd9a3fff1ef789b6e71cfe4535 /cadr.h
parent37e9a5d1f8ec90c2fe1cddd0546655ad2afc1dac (diff)
downloadtxr-06d0ada8a9ff7078f8ab89d5b4ce36f04587dc62.tar.gz
txr-06d0ada8a9ff7078f8ab89d5b4ce36f04587dc62.tar.bz2
txr-06d0ada8a9ff7078f8ab89d5b4ce36f04587dc62.zip
debugger: expand frames.
This patch adds special unwind frames for backtracing expansions. With this, we can get rid of the global variable last_form_expanded, since to get the last form expanded, we just search for the most enclosing expand frame. * eval.c (last_form_expanded): Global variable removed. (error_trace): Use uw_last_form_expanded() instead of last_form_expanded. (expand_eval): No need to save and restore last_form_expanded any more. (expand_lisp_setq, expand_setqf, expand_lisp1, do_expand): Use uw_last_form_expanded(). (expand, do_macroexpand_1): Push and pop expand frame. This fixes a bug: do_macroexpand_1 was not recording last_form_expanded. Evaluation of top-level forms uses explicit macroexpansion, therefore top-level evaluation was neglecting to set last_form_expanded. This explains weird behavior I saw in the listener from time to time, when errors would report against the expansion of the wrong form. (eval_init): Remove reference to last_form_expanded variable. * eval.h (last_form_expanded): Declaration removed. * share/txr/stdlib/debug.tl (expand-frame print-trace, expand-frame loc): New methods. (print-backtrace): Include uw-expand frames in the backtrace. * unwind.c (expand_frame_type): New static variable. (uw_find_frames_by_mask): Handle UW_EXPAND. (uw_last_form_expanded, uw_push_expand): New functions. (uw_late_init): Register expand-frame struct type. * unwind.h (enum uw_frtype): New enum member, UW_EXPAND. (uw_last_form_expanded, uw_push_expand): Declared.
Diffstat (limited to 'cadr.h')
0 files changed, 0 insertions, 0 deletions