mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-02-26 01:40:41 -05:00
debug: Fix printing of new ids
The client side closure traces have incorrect object ids for new server generated objects. This is because create_proxies() overwrites the id in 'n' type arguments by storing a pointer to the actual object in the 'o' field of the union. Getting back to an id from this pointer requires accessing a structure that isn't visible outside of wayland-client.c. Add a function pointer to fish the correct value out of the argument and pass it to wl_closure_print. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
9c05e6c475
commit
ca893075ef
4 changed files with 29 additions and 9 deletions
|
|
@ -1264,13 +1264,14 @@ 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 discarded)
|
||||
int send, int discarded, uint32_t (*n_parse)(union wl_argument *arg))
|
||||
{
|
||||
int i;
|
||||
struct argument_details arg;
|
||||
const char *signature = closure->message->signature;
|
||||
struct timespec tp;
|
||||
unsigned int time;
|
||||
uint32_t nval;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &tp);
|
||||
time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
|
||||
|
|
@ -1322,12 +1323,17 @@ wl_closure_print(struct wl_closure *closure, struct wl_object *target,
|
|||
fprintf(stderr, "nil");
|
||||
break;
|
||||
case 'n':
|
||||
if (n_parse)
|
||||
nval = n_parse(&closure->args[i]);
|
||||
else
|
||||
nval = closure->args[i].n;
|
||||
|
||||
fprintf(stderr, "new id %s@",
|
||||
(closure->message->types[i]) ?
|
||||
closure->message->types[i]->name :
|
||||
"[unknown]");
|
||||
if (closure->args[i].n != 0)
|
||||
fprintf(stderr, "%u", closure->args[i].n);
|
||||
if (nval != 0)
|
||||
fprintf(stderr, "%u", nval);
|
||||
else
|
||||
fprintf(stderr, "nil");
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue