[Pdbg] [PATCH v5 5/5] mem: CR and LF are printable characters
Amitay Isaacs
amitay at ozlabs.org
Wed Apr 10 18:01:51 AEST 2019
isprint() does not consider CR and LF as printable.
As a special case, do not consider 0 as non-printable character. This
allows printing of NULL terminated strings in the buffer.
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
src/mem.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/mem.c b/src/mem.c
index b264d98..9c047ec 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -81,6 +81,9 @@ static int _getmem(uint64_t addr, uint64_t size, uint8_t block_size, bool ci)
bool printable = true;
for (i=0; i<size; i++) {
+ if (buf[i] == 0x0a || buf[i] == 0x0d || buf[i] == 0)
+ continue;
+
if (!isprint(buf[i])) {
printable = false;
break;
--
2.20.1
More information about the Pdbg
mailing list