[PATCH] debug: print from where protocol message originated
Tiago Vignatti
tiago.vignatti at intel.com
Tue Mar 27 14:16:13 PDT 2012
In times where Weston and client shells are started at the same time, this
makes debugging much more effective. It's [S] for server and [C] for clients,
so now you will see something like this:
[4231274.870][C] -> wl_display at 1.sync(new id 10)
[4231275.040][S] wl_drm at 9.authenticate(27)
[4231275.189][S] -> wl_drm at 9.authenticated()
[4231275.279][S] wl_display at 1.sync(new id 10)
[4231275.391][S] -> wl_callback at 10.done(0)
[4231275.503][S] -> wl_display at 1.delete_id(10)
[4231275.653][C] wl_drm at 9.authenticated()
Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
src/connection.c | 6 ++++--
src/wayland-client.c | 4 ++--
src/wayland-private.h | 3 ++-
src/wayland-server.c | 6 +++---
4 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/connection.c b/src/connection.c
index ca4a24c..1437b5c 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -786,7 +786,8 @@ 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)
+wl_closure_print(struct wl_closure *closure, struct wl_object *target,
+ int send, int is_compositor)
{
union wl_value *value;
int i;
@@ -796,8 +797,9 @@ wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send)
clock_gettime(CLOCK_REALTIME, &tp);
time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
- fprintf(stderr, "[%10.3f] %s%s@%u.%s(",
+ fprintf(stderr, "[%10.3f][%c] %s%s@%u.%s(",
time / 1000.0,
+ is_compositor ? 'S' : 'C',
send ? " -> " : "",
target->interface->name, target->id,
closure->message->name);
diff --git a/src/wayland-client.c b/src/wayland-client.c
index 498a429..5879435 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -209,7 +209,7 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
}
if (wl_debug)
- wl_closure_print(closure, &proxy->object, true);
+ wl_closure_print(closure, &proxy->object, true, false);
wl_closure_destroy(closure);
}
@@ -487,7 +487,7 @@ handle_event(struct wl_display *display,
}
if (wl_debug)
- wl_closure_print(closure, &proxy->object, false);
+ wl_closure_print(closure, &proxy->object, false, false);
wl_closure_invoke(closure, &proxy->object,
proxy->object.implementation[opcode],
diff --git a/src/wayland-private.h b/src/wayland-private.h
index b843e89..5738693 100644
--- a/src/wayland-private.h
+++ b/src/wayland-private.h
@@ -88,7 +88,8 @@ wl_closure_send(struct wl_closure *closure, struct wl_connection *connection);
int
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);
+wl_closure_print(struct wl_closure *closure, struct wl_object *target,
+ int send, int is_compositor);
void
wl_closure_destroy(struct wl_closure *closure);
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 899c094..d6d23c2 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -117,7 +117,7 @@ wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
destroy_client, resource->client);
if (wl_debug)
- wl_closure_print(closure, object, true);
+ wl_closure_print(closure, object, true, true);
wl_closure_destroy(closure);
}
@@ -144,7 +144,7 @@ wl_resource_queue_event(struct wl_resource *resource, uint32_t opcode, ...)
destroy_client, resource->client);
if (wl_debug)
- wl_closure_print(closure, object, true);
+ wl_closure_print(closure, object, true, true);
wl_closure_destroy(closure);
}
@@ -245,7 +245,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
}
if (wl_debug)
- wl_closure_print(closure, object, false);
+ wl_closure_print(closure, object, false, true);
wl_closure_invoke(closure, object,
object->implementation[opcode], client);
--
1.7.5.4
More information about the wayland-devel
mailing list