[Pdbg] [PATCH v6 5/5] mem: CR and LF are printable characters
Amitay Isaacs
amitay at ozlabs.org
Wed Apr 17 16:03:03 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>
Reviewed-by: Joel Stanley <joel at jms.id.au>
---
src/mem.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/mem.c b/src/mem.c
index 431d2b6..c8bf0d2 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -92,6 +92,9 @@ static int _getmem(uint64_t addr, uint64_t size, uint8_t block_size, bool ci, bo
PR_ERROR("Unable to write stdout.\n");
} else {
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