Skip to content

Commit

Permalink
dmesg.py:use 'replace' avoid decode error
Browse files Browse the repository at this point in the history
Signed-off-by: anjiahao <[email protected]>
  • Loading branch information
anjiahao1 authored and xiaoxiang781216 committed Nov 23, 2024
1 parent 8b4a4f8 commit 472b49e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/gdb/nuttxgdb/dmesg.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def invoke(self, args, from_tty):
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")

0 comments on commit 472b49e

Please sign in to comment.