m1n1.trace.asc.Syslog: Fix message termination

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2021-06-24 01:15:15 +09:00
parent 7687d00f5f
commit 3cfe943ec3

View file

@ -274,8 +274,8 @@ class Syslog(EP):
buf = self.state.syslog_buf buf = self.state.syslog_buf
log = self.tracer.dart.ioread(0, buf + msg.INDEX * 0xa0, 0xa0) log = self.tracer.dart.ioread(0, buf + msg.INDEX * 0xa0, 0xa0)
hdr, unk, context, logmsg = struct.unpack("<II24s128s", log) hdr, unk, context, logmsg = struct.unpack("<II24s128s", log)
context = context.rstrip(b"\x00").decode("ascii") context = context.split(b"\x00")[0].decode("ascii")
logmsg = logmsg.rstrip(b"\x00").decode("ascii").rstrip("\n") logmsg = logmsg.split(b"\x00")[0].decode("ascii").rstrip("\n")
self.log(f"* [{context}]{logmsg}") self.log(f"* [{context}]{logmsg}")
return True return True