From c5e32c69952222b12e65655474c5f4c4481ea9f7 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 23 Apr 2014 03:40:24 +0300 Subject: vm: Add rudimentary bytecode execution tracing capability. --- py/vm.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'py/vm.c') diff --git a/py/vm.c b/py/vm.c index b1c1719b7..8a0bc7dbe 100644 --- a/py/vm.c +++ b/py/vm.c @@ -14,6 +14,11 @@ #include "objgenerator.h" #define DETECT_VM_STACK_OVERFLOW (0) +#if 0 +#define TRACE(ip) mp_byte_code_print2(ip, 1); +#else +#define TRACE(ip) +#endif // Value stack grows up (this makes it incompatible with native C stack, but // makes sure that arguments to functions are in natural order arg1..argN @@ -168,6 +173,7 @@ mp_vm_return_kind_t mp_execute_byte_code_2(const byte *code_info, const byte **i #if MICROPY_USE_COMPUTED_GOTO #include "vmentrytable.h" #define DISPATCH() do { \ + TRACE(ip); \ save_ip = ip; \ op = *ip++; \ goto *entry_table[op]; \ @@ -223,6 +229,7 @@ dispatch_loop: #if MICROPY_USE_COMPUTED_GOTO DISPATCH(); #else + TRACE(ip); save_ip = ip; op = *ip++; -- cgit v1.2.3