aboutsummaryrefslogtreecommitdiff
path: root/py/showbc.c
diff options
context:
space:
mode:
authorDamien George2014-03-28 18:38:20 +0000
committerDamien George2014-03-28 18:38:20 +0000
commit440f041525a01990827823d2fccd3c081ea92a14 (patch)
tree4686cb4f3367b165d809ae305f8455b60629f47a /py/showbc.c
parent182c31a2085c89c722f188102603ce857696de11 (diff)
py: Fix bugs with debugging output.
show_bc now decodes the prelude correctly. Moved WRITE_FILE stuff from runtime.c to emitglue.c. Addresses issue #385.
Diffstat (limited to 'py/showbc.c')
-rw-r--r--py/showbc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/py/showbc.c b/py/showbc.c
index d4382de44..12bd90118 100644
--- a/py/showbc.c
+++ b/py/showbc.c
@@ -30,7 +30,16 @@ void mp_byte_code_print(const byte *ip, int len) {
machine_uint_t code_info_size = ip[0] | (ip[1] << 8) | (ip[2] << 16) | (ip[3] << 24);
ip += code_info_size;
- // decode prelude
+ // bytecode prelude: state size and exception stack size; 16 bit uints
+ {
+ uint n_state = ip[0] | (ip[1] << 8);
+ uint n_exc_stack = ip[2] | (ip[3] << 8);
+ ip += 4;
+ printf("(N_STATE %u)\n", n_state);
+ printf("(N_EXC_STACK %u)\n", n_exc_stack);
+ }
+
+ // bytecode prelude: initialise closed over variables
{
uint n_local = *ip++;
printf("(NUM_LOCAL %u)\n", n_local);