dmesg.py:use 'replace' avoid decode error

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2024-09-18 16:23:14 +08:00 committed by Xiang Xiao
parent 8b4a4f8539
commit 472b49e11f

View file

@ -43,7 +43,6 @@ class Dmesg(gdb.Command):
gdb.write("Ramlog have %d bytes to show\n" % rl_bufsize)
inf = gdb.selected_inferior()
buf = inf.read_memory(rl_head["rl_buffer"], rl_bufsize)
clean_data = bytes(buf).replace(b"\x00", "".encode("utf-8"))
gdb.write(clean_data.decode("utf-8"))
buf = bytes(inf.read_memory(rl_head["rl_buffer"], rl_bufsize))
gdb.write(buf.decode("utf-8", errors="replace"))
gdb.write("\n")