diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-13 11:22:44 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-13 11:22:44 +0100 |
commit | 3d484d9ad45a8fc3b088047249d1304af77ec667 (patch) | |
tree | be0a9841c1efc8471fca6b46d26249b299bd2cdf /py | |
parent | 0aab67510828a11a5ae225d573c4da9325c5ce58 (diff) | |
download | micropython-3d484d9ad45a8fc3b088047249d1304af77ec667.tar.gz micropython-3d484d9ad45a8fc3b088047249d1304af77ec667.zip |
py: Update showbc to decode ptrs for MAKE_FUNCTION ops.
Diffstat (limited to 'py')
-rw-r--r-- | py/showbc.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/py/showbc.c b/py/showbc.c index 615d1fe0de..25b1b2ffb6 100644 --- a/py/showbc.c +++ b/py/showbc.c @@ -22,6 +22,11 @@ qstr = (qstr << 7) + (*ip & 0x7f); \ } while ((*ip++ & 0x80) != 0); \ } +#define DECODE_PTR do { \ + ip = (byte*)(((machine_uint_t)ip + sizeof(machine_uint_t) - 1) & (~(sizeof(machine_uint_t) - 1))); /* align ip */ \ + unum = *(machine_uint_t*)ip; \ + ip += sizeof(machine_uint_t); \ +} while (0) void mp_byte_code_print(const byte *ip, int len) { const byte *ip_start = ip; @@ -389,22 +394,22 @@ void mp_byte_code_print(const byte *ip, int len) { break; case MP_BC_MAKE_FUNCTION: - DECODE_UINT; + DECODE_PTR; printf("MAKE_FUNCTION " UINT_FMT, unum); break; case MP_BC_MAKE_FUNCTION_DEFARGS: - DECODE_UINT; + DECODE_PTR; printf("MAKE_FUNCTION_DEFARGS " UINT_FMT, unum); break; case MP_BC_MAKE_CLOSURE: - DECODE_UINT; + DECODE_PTR; printf("MAKE_CLOSURE " UINT_FMT, unum); break; case MP_BC_MAKE_CLOSURE_DEFARGS: - DECODE_UINT; + DECODE_PTR; printf("MAKE_CLOSURE_DEFARGS " UINT_FMT, unum); break; |