diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-12-07 13:45:01 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-12-07 13:45:01 -0800 |
commit | 2a81a54726fdb8ad94bee9efc85020a808c618b5 (patch) | |
tree | dc1637ba98d37a675cd4efb51f07fe735ff6816b | |
parent | 08a8cb2a8c5e266a3dbc3b661c326b1ef9b39d5c (diff) | |
download | mu-2a81a54726fdb8ad94bee9efc85020a808c618b5.tar.gz |
4148
-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 |