The current behaviour when WAYLAND_DEBUG is set is to print “array”,
which is quite unhelpful.

This patch prints a list of the bytes present in the array.  It doesn’t
try to interpret it as uint32_t or anything, leaving that to the reader
because this information isn’t present in the protocol description.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.pey...@collabora.com>
---
 src/connection.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index 5c3d187..d616ddd 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1170,11 +1170,13 @@ wl_closure_queue(struct wl_closure *closure, struct 
wl_connection *connection)
 void
 wl_closure_print(struct wl_closure *closure, struct wl_object *target, int 
send)
 {
-       int i;
+       int i, j;
        struct argument_details arg;
        const char *signature = closure->message->signature;
        struct timespec tp;
        unsigned int time;
+       size_t size;
+       char *data;
 
        clock_gettime(CLOCK_REALTIME, &tp);
        time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
@@ -1223,7 +1225,15 @@ wl_closure_print(struct wl_closure *closure, struct 
wl_object *target, int send)
                                fprintf(stderr, "nil");
                        break;
                case 'a':
-                       fprintf(stderr, "array");
+                       fprintf(stderr, "array(");
+                       size = closure->args[i].a->size;
+                       data = (char*)closure->args[i].a->data;
+                       if (size) {
+                               for (j = 0; j < (int)size - 1; j++)
+                                       fprintf(stderr, "0x%02x, ", data[j]);
+                               fprintf(stderr, "0x%02x", data[size - 1]);
+                       }
+                       fprintf(stderr, ")");
                        break;
                case 'h':
                        fprintf(stderr, "fd %d", closure->args[i].h);
-- 
2.13.2

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to