Skip to content

Commit

Permalink
gdb/dmesg: replace non-printable NULL terminator
Browse files Browse the repository at this point in the history
Signed-off-by: xuxingliang <[email protected]>
  • Loading branch information
XuNeo authored and xiaoxiang781216 committed Nov 23, 2024
1 parent 472b49e commit 4e6026e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/gdb/nuttxgdb/dmesg.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@ def invoke(self, args, from_tty):

inf = gdb.selected_inferior()
buf = bytes(inf.read_memory(rl_head["rl_buffer"], rl_bufsize))
buf = buf.replace(
b"\0", "␀".encode("utf-8")
) # NULL is valid utf-8 but not printable
gdb.write(buf.decode("utf-8", errors="replace"))
gdb.write("\n")

0 comments on commit 4e6026e

Please sign in to comment.