summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-06-02 16:11:16 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-06-02 16:35:57 +0300
commit8bf8404c155f9ee9a2afd7f85c5f0a8aed1d2e2d (patch)
treeba8f60a059a96df7db39dbcc96cfaeed814517a1 /py
parentb325d25e46130b65373eeb1a5d3c2a405665f320 (diff)
downloadmicropython-8bf8404c155f9ee9a2afd7f85c5f0a8aed1d2e2d.tar.gz
micropython-8bf8404c155f9ee9a2afd7f85c5f0a8aed1d2e2d.zip
showbc: Print code block header at the beginning, not in the middle of dump.
Also, dump code block in bytes.
Diffstat (limited to 'py')
-rw-r--r--py/showbc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/py/showbc.c b/py/showbc.c
index fc02f4c580..8169368410 100644
--- a/py/showbc.c
+++ b/py/showbc.c
@@ -64,6 +64,10 @@ void mp_bytecode_print(const byte *ip, int len) {
const byte *code_info = ip;
ip += code_info_size;
+ qstr source_file = code_info[4] | (code_info[5] << 8) | (code_info[6] << 16) | (code_info[7] << 24);
+ qstr block_name = code_info[8] | (code_info[9] << 8) | (code_info[10] << 16) | (code_info[11] << 24);
+ printf("File %s, code block '%s' (%d bytes)\n", qstr_str(source_file), qstr_str(block_name), len);
+
// bytecode prelude: state size and exception stack size; 16 bit uints
{
uint n_state = ip[0] | (ip[1] << 8);
@@ -87,9 +91,6 @@ void mp_bytecode_print(const byte *ip, int len) {
// print out line number info
{
- qstr source_file = code_info[4] | (code_info[5] << 8) | (code_info[6] << 16) | (code_info[7] << 24);
- qstr block_name = code_info[8] | (code_info[9] << 8) | (code_info[10] << 16) | (code_info[11] << 24);
- printf("File %s, block '%s'\n", qstr_str(source_file), qstr_str(block_name));
machine_int_t bc = (code_info + code_info_size) - ip;
machine_uint_t source_line = 1;
printf(" bc=" INT_FMT " line=" UINT_FMT "\n", bc, source_line);