summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-09-20 11:30:54 +1000
committerDamien George <damien.p.george@gmail.com>2016-09-20 11:30:54 +1000
commitfbddea929d28fa75ecc4e964500eca3f2ac32e4b (patch)
treec22d7da9548bdf71479e509ce2c090629d7e8398
parent60592fd23c8acd4ed4f70d8fbe8f8b11ea58082c (diff)
downloadmicropython-fbddea929d28fa75ecc4e964500eca3f2ac32e4b.tar.gz
micropython-fbddea929d28fa75ecc4e964500eca3f2ac32e4b.zip
py/showbc: Make printf's go to the platform print stream.
The system printf is no longer used by the core uPy code. Instead, the platform print stream or DEBUG_printf is used. Using DEBUG_printf in the showbc functions would mean that the code can't be tested by the test suite, so use the normal output instead. This patch also fixes parsing of bytecode-line-number mappings.
-rw-r--r--py/showbc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/showbc.c b/py/showbc.c
index 0f335ffeff..684d9af0c0 100644
--- a/py/showbc.c
+++ b/py/showbc.c
@@ -32,6 +32,9 @@
#if MICROPY_DEBUG_PRINTERS
+// redirect all printfs in this file to the platform print stream
+#define printf(...) mp_printf(&mp_plat_print, __VA_ARGS__)
+
#define DECODE_UINT { \
unum = 0; \
do { \
@@ -96,6 +99,7 @@ void mp_bytecode_print(const void *descr, const byte *ip, mp_uint_t len, const m
#if MICROPY_PERSISTENT_CODE
qstr block_name = code_info[0] | (code_info[1] << 8);
qstr source_file = code_info[2] | (code_info[3] << 8);
+ code_info += 4;
#else
qstr block_name = mp_decode_uint(&code_info);
qstr source_file = mp_decode_uint(&code_info);