diff options
author | Martin Milata <martin@martinmilata.cz> | 2020-08-13 15:20:08 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-08-21 16:17:07 +1000 |
commit | 492cf34fd860330f44a74732d89e9db8bc02a4e8 (patch) | |
tree | b6dcf1c044728bd6a46ddaa4120ce09c7df41c72 | |
parent | 60cf2c0959ed2668c01df664a2e7c3cd1f5c6d89 (diff) |
tools/mpy-tool.py: Fix offset of line number info.
Signed-off-by: Martin Milata <martin@martinmilata.cz>
-rwxr-xr-x | tools/mpy-tool.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 43d35503e..1ac6c93d7 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -253,6 +253,7 @@ class RawCode(object): self.ip, self.ip2, self.prelude = extract_prelude(self.bytecode, self.prelude_offset) self.simple_name = self._unpack_qstr(self.ip2) self.source_file = self._unpack_qstr(self.ip2 + 2) + self.line_info_offset = self.ip2 + 4 def _unpack_qstr(self, ip): qst = self.bytecode[ip] | self.bytecode[ip + 1] << 8 @@ -404,7 +405,10 @@ class RawCode(object): print(" .n_def_pos_args = %u," % self.prelude[5]) print(" .qstr_block_name = %s," % self.simple_name.qstr_id) print(" .qstr_source_file = %s," % self.source_file.qstr_id) - print(" .line_info = fun_data_%s + %u," % (self.escaped_name, 0)) # TODO + print( + " .line_info = fun_data_%s + %u," + % (self.escaped_name, self.line_info_offset) + ) print(" .opcodes = fun_data_%s + %u," % (self.escaped_name, self.ip)) print(" },") print(" .line_of_definition = %u," % 0) # TODO |