[PATCH v3 1/6] Add print_uint8_array_member() helper

Kent Gibson warthog618 at gmail.com
Sat Jan 23 00:04:00 UTC 2021


Add print_uint8_array_method() helper, to be used by the GPIO ioctl
decoding, and the corresponding int8 function to match.

Signed-off-by: Kent Gibson <warthog618 at gmail.com>
---
 defs.h |  4 ++++
 util.c | 18 ++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/defs.h b/defs.h
index 73579591..cc7b4505 100644
--- a/defs.h
+++ b/defs.h
@@ -899,6 +899,10 @@ extern void print_kernel_version(unsigned long version);
 extern void print_abnormal_hi(kernel_ulong_t);
 extern void print_ioprio(unsigned int ioprio);
 
+extern bool print_int8_array_member(struct tcb *, void *elem_buf,
+				    size_t elem_size, void *data);
+extern bool print_uint8_array_member(struct tcb *, void *elem_buf,
+				     size_t elem_size, void *data);
 extern bool print_int32_array_member(struct tcb *, void *elem_buf,
 				     size_t elem_size, void *data);
 extern bool print_uint32_array_member(struct tcb *, void *elem_buf,
diff --git a/util.c b/util.c
index 481144bf..3a43954a 100644
--- a/util.c
+++ b/util.c
@@ -1306,6 +1306,24 @@ umoven_or_printaddr64_ignore_syserror(struct tcb *const tcp,
 	return -1;
 }
 
+bool
+print_int8_array_member(struct tcb *tcp, void *elem_buf, size_t elem_size,
+			void *data)
+{
+	tprintf("%" PRId8, *(int8_t *) elem_buf);
+
+	return true;
+}
+
+bool
+print_uint8_array_member(struct tcb *tcp, void *elem_buf, size_t elem_size,
+			 void *data)
+{
+	tprintf("%" PRIu8, *(uint8_t *) elem_buf);
+
+	return true;
+}
+
 bool
 print_int32_array_member(struct tcb *tcp, void *elem_buf, size_t elem_size,
 			 void *data)
-- 
2.30.0



More information about the Strace-devel mailing list