Fix #12290: crash_log_parser on py3

pull/12419/head
Mark Edgeworth 2020-02-12 14:56:35 +00:00
parent 69a2803319
commit 2ad6f45d83
1 changed files with 4 additions and 4 deletions

View File

@ -32,8 +32,8 @@ _PTN = re.compile("([0-9a-f]*) ([Tt]) ([^\t\n]*)(?:\t(.*):([0-9]*))?")
class ElfHelper(object): class ElfHelper(object):
def __init__(self, elf_file, map_file): def __init__(self, elf_file, map_file):
op = check_output([_NM_EXEC, _OPT, elf_file.name]) op = check_output([_NM_EXEC, _OPT, elf_file.name]).decode('utf-8')
self.maplines = map_file.readlines() self.maplines = map_file.readlines()
self.matches = _PTN.findall(op) self.matches = _PTN.findall(op)
self.addrs = [int(x[0], 16) for x in self.matches] self.addrs = [int(x[0], 16) for x in self.matches]
@ -115,8 +115,8 @@ def parse_line_for_register(line):
def main(crash_log, elfhelper): def main(crash_log, elfhelper):
mmfar_val = 0 mmfar_val = 0
bfar_val = 0 bfar_val = 0
lines = iter(crash_log.read().splitlines()) lines = iter(crash_log.read().decode('utf-8').splitlines())
for eachline in lines: for eachline in lines:
if "++ MbedOS Fault Handler ++" in eachline: if "++ MbedOS Fault Handler ++" in eachline:
break break