From 4e6026efe637c1eda57ffc1d7fd8b18f58571ae7 Mon Sep 17 00:00:00 2001 From: xuxingliang Date: Wed, 16 Oct 2024 12:23:20 +0800 Subject: [PATCH] gdb/dmesg: replace non-printable NULL terminator Signed-off-by: xuxingliang --- tools/gdb/nuttxgdb/dmesg.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/gdb/nuttxgdb/dmesg.py b/tools/gdb/nuttxgdb/dmesg.py index 1c75aace089..8d4036b1152 100644 --- a/tools/gdb/nuttxgdb/dmesg.py +++ b/tools/gdb/nuttxgdb/dmesg.py @@ -44,5 +44,8 @@ class Dmesg(gdb.Command): 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")