From ace9fb54053c29574bdf81ffacc5ddcf9d4b45d9 Mon Sep 17 00:00:00 2001 From: Stefan Naumann <me@stefannaumann.de> Date: Mon, 24 Jul 2017 18:55:14 +0200 Subject: [PATCH] py: Add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE. It enables all the DEBUG_printf outputs in the py/ source code. --- py/bc.c | 2 +- py/builtinimport.c | 2 +- py/emitglue.c | 2 +- py/emitnative.c | 2 +- py/gc.c | 2 +- py/malloc.c | 2 +- py/modthread.c | 2 +- py/mpconfig.h | 5 +++++ py/nativeglue.c | 2 +- py/objfun.c | 2 +- py/objtype.c | 2 +- py/qstr.c | 2 +- py/runtime.c | 2 +- 13 files changed, 17 insertions(+), 12 deletions(-) diff --git a/py/bc.c b/py/bc.c index 522eb0aeb..917eba57d 100644 --- a/py/bc.c +++ b/py/bc.c @@ -35,7 +35,7 @@ #include "py/bc0.h" #include "py/bc.h" -#if 0 // print debugging info +#if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) #else // don't print debugging info #define DEBUG_PRINT (0) diff --git a/py/builtinimport.c b/py/builtinimport.c index e0ce91d9b..f5bfb0d98 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -37,7 +37,7 @@ #include "py/builtin.h" #include "py/frozenmod.h" -#if 0 // print debugging info +#if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) #define DEBUG_printf DEBUG_printf #else // don't print debugging info diff --git a/py/emitglue.c b/py/emitglue.c index 383e6a136..d2add988f 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -35,7 +35,7 @@ #include "py/runtime0.h" #include "py/bc.h" -#if 0 // print debugging info +#if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) #define WRITE_CODE (1) #define DEBUG_printf DEBUG_printf diff --git a/py/emitnative.c b/py/emitnative.c index 7ce619625..4608cd1e0 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -50,7 +50,7 @@ #include "py/emit.h" #include "py/bc.h" -#if 0 // print debugging info +#if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) #define DEBUG_printf DEBUG_printf #else // don't print debugging info diff --git a/py/gc.c b/py/gc.c index 7253b7db6..3a505e9c7 100644 --- a/py/gc.c +++ b/py/gc.c @@ -35,7 +35,7 @@ #if MICROPY_ENABLE_GC -#if 0 // print debugging info +#if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) #define DEBUG_printf DEBUG_printf #else // don't print debugging info diff --git a/py/malloc.c b/py/malloc.c index e679e2092..af4ccf2e8 100644 --- a/py/malloc.c +++ b/py/malloc.c @@ -32,7 +32,7 @@ #include "py/misc.h" #include "py/mpstate.h" -#if 0 // print debugging info +#if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_printf DEBUG_printf #else // don't print debugging info #define DEBUG_printf(...) (void)0 diff --git a/py/modthread.c b/py/modthread.c index 1d7602789..bf74128e8 100644 --- a/py/modthread.c +++ b/py/modthread.c @@ -34,7 +34,7 @@ #include "py/mpthread.h" -#if 0 // print debugging info +#if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) #define DEBUG_printf DEBUG_printf #else // don't print debugging info diff --git a/py/mpconfig.h b/py/mpconfig.h index 0e76a1ff5..dac8a903c 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -373,6 +373,11 @@ #define MICROPY_DEBUG_PRINTERS (0) #endif +// Whether to enable all debugging outputs (it will be extremely verbose) +#ifndef MICROPY_DEBUG_VERBOSE +#define MICROPY_DEBUG_VERBOSE (0) +#endif + /*****************************************************************************/ /* Optimisations */ diff --git a/py/nativeglue.c b/py/nativeglue.c index 46c6906d9..e954234c2 100644 --- a/py/nativeglue.c +++ b/py/nativeglue.c @@ -34,7 +34,7 @@ #include "py/emitglue.h" #include "py/bc.h" -#if 0 // print debugging info +#if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_printf DEBUG_printf #else // don't print debugging info #define DEBUG_printf(...) (void)0 diff --git a/py/objfun.c b/py/objfun.c index eaba13129..5606511d8 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -36,7 +36,7 @@ #include "py/bc.h" #include "py/stackctrl.h" -#if 0 // print debugging info +#if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) #else // don't print debugging info #define DEBUG_PRINT (0) diff --git a/py/objtype.c b/py/objtype.c index 87c0cc9e5..e1a24da7e 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -35,7 +35,7 @@ #include "py/runtime0.h" #include "py/runtime.h" -#if 0 // print debugging info +#if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) #define DEBUG_printf DEBUG_printf #else // don't print debugging info diff --git a/py/qstr.c b/py/qstr.c index fdb38f1de..95c9b6835 100644 --- a/py/qstr.c +++ b/py/qstr.c @@ -36,7 +36,7 @@ // ultimately we will replace this with a static hash table of some kind // also probably need to include the length in the string data, to allow null bytes in the string -#if 0 // print debugging info +#if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_printf DEBUG_printf #else // don't print debugging info #define DEBUG_printf(...) (void)0 diff --git a/py/runtime.c b/py/runtime.c index 9c3edeb9c..eb1298813 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -44,7 +44,7 @@ #include "py/stackctrl.h" #include "py/gc.h" -#if 0 // print debugging info +#if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) #define DEBUG_printf DEBUG_printf #define DEBUG_OP_printf(...) DEBUG_printf(__VA_ARGS__) -- GitLab