aboutsummaryrefslogtreecommitdiff
path: root/py/qstr.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-02-10 11:02:28 +0000
committerDamien George <damien.p.george@gmail.com>2015-02-10 11:02:28 +0000
commitea0461dcd390135561651036f39606d50ce12999 (patch)
treed2db3ac831ea5d7aa60011d8ac562a2fbfa3f0c3 /py/qstr.c
parent53716fcc3effbce1b7cca49d8df30ecaad8bc1dc (diff)
py: Add option to micropython.qstr_info() to dump actual qstrs.
Diffstat (limited to 'py/qstr.c')
-rw-r--r--py/qstr.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/py/qstr.c b/py/qstr.c
index 813f25150..2d57f2222 100644
--- a/py/qstr.c
+++ b/py/qstr.c
@@ -26,6 +26,7 @@
#include <assert.h>
#include <string.h>
+#include <stdio.h>
#include "py/mpstate.h"
#include "py/qstr.h"
@@ -229,3 +230,13 @@ void qstr_pool_info(mp_uint_t *n_pool, mp_uint_t *n_qstr, mp_uint_t *n_str_data_
}
*n_total_bytes += *n_str_data_bytes;
}
+
+#if MICROPY_PY_MICROPYTHON_MEM_INFO
+void qstr_dump_data(void) {
+ for (qstr_pool_t *pool = MP_STATE_VM(last_pool); pool != NULL && pool != &const_pool; pool = pool->prev) {
+ for (const byte **q = pool->qstrs, **q_top = pool->qstrs + pool->len; q < q_top; q++) {
+ printf("Q(%s)\n", Q_GET_DATA(*q));
+ }
+ }
+}
+#endif