tools/mpy-tool.py: Fix offset of line number info.

Signed-off-by: Martin Milata <martin@martinmilata.cz>
pull/6356/head
Martin Milata 2020-08-13 15:20:08 +02:00 zatwierdzone przez Damien George
rodzic 60cf2c0959
commit 492cf34fd8
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -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