diff options
-rw-r--r-- | 026call.cc | 8 | ||||
-rw-r--r-- | 076continuation.cc | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/026call.cc b/026call.cc index 96fd8660..3ae636b8 100644 --- a/026call.cc +++ b/026call.cc @@ -216,7 +216,11 @@ case _DUMP_CALL_STACK: { } :(before "End Primitive Recipe Implementations") case _DUMP_CALL_STACK: { - for (call_stack::const_reverse_iterator p = Current_routine->calls.rbegin(); p != Current_routine->calls.rend(); ++p) - cerr << get(Recipe, p->running_recipe).name << ":" << p->running_step_index << " -- " << to_string(to_instruction(*p)) << '\n'; + dump(Current_routine->calls); break; } +:(code) +void dump(const call_stack& calls) { + for (call_stack::const_reverse_iterator p = calls.rbegin(); p != calls.rend(); ++p) + cerr << get(Recipe, p->running_recipe).name << ":" << p->running_step_index << " -- " << to_string(to_instruction(*p)) << '\n'; +} diff --git a/076continuation.cc b/076continuation.cc index e3a84a51..59f4a2da 100644 --- a/076continuation.cc +++ b/076continuation.cc @@ -341,6 +341,16 @@ bool is_mu_continuation(reagent/*copy*/ x) { return x.type && x.type->atom && x.type->value == get(Type_ordinal, "continuation"); } +// helper for debugging +void dump(const int continuation_id) { + if (!contains_key(Delimited_continuation, continuation_id)) { + raise << "missing delimited continuation: " << continuation_id << '\n' << end(); + return; + } + delimited_continuation& curr = get(Delimited_continuation, continuation_id); + dump(curr.frames); +} + :(scenario continuations_can_be_copied) def main [ local-scope |