[Sound-open-firmware] [PATCH] rmbox: check for non printable chars in trace.

Liam Girdwood liam.r.girdwood at linux.intel.com
Mon Sep 4 17:35:43 CEST 2017


Non printable means trace is a value.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 rmbox/rmbox.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/rmbox/rmbox.c b/rmbox/rmbox.c
index 1f81e06..3ef6fb4 100644
--- a/rmbox/rmbox.c
+++ b/rmbox/rmbox.c
@@ -19,6 +19,7 @@
 #include <stdint.h>
 #include <errno.h>
 #include <string.h>
+#include <ctype.h>
 
 // TODO: include all this stuff
 
@@ -135,6 +136,12 @@ static void show_trace(uint32_t val, uint32_t addr, uint32_t *timestamp, float c
 		return;
 	}
 
+	/* check for printable values - otherwise it's a value */
+	if (!isprint((char)(val >> 16)) || !isprint((char)(val >> 8)) || !isprint((char)val)) {
+		printf("value 0x%8.8x\n", (uint32_t)val);
+		return;
+	}
+
 	class = val & 0xff000000;
 	if (class == TRACE_CLASS_IRQ)
 		trace = "irq";
-- 
2.11.0



More information about the Sound-open-firmware mailing list