minidumpserver.py:Print the line number of logfile when the format is wrong

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2023-07-05 15:38:40 +08:00 committed by Xiang Xiao
parent 8c56354dc8
commit ffb391f6aa
1 changed files with 69 additions and 62 deletions

View File

@ -247,11 +247,15 @@ class dump_log_file:
start = 0
if self.fd is None:
self.open()
linenumber = 0
try:
while 1:
line = self.fd.readline()
if line == "":
break
linenumber += 1
tmp = re.search("up_dump_register:", line)
if tmp is not None:
# find arch
@ -320,6 +324,9 @@ class dump_log_file:
"<I", int("0x" + tmp.group().replace(" ", ""), 16)
)
line = line[tmp.span()[1] :]
except Exception as e:
logger.error("parse log file error: %s linenumber %d" % (e, linenumber))
os._exit(0)
if len(data):
memory = {"start": start, "end": start + len(data), "data": data}