From 56fada47f2343ac05df81a23a3e3237bbe6872a2 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 3 Oct 2023 13:30:16 +0200 Subject: [PATCH] src: default to stream=stderr in handle printer (#4161) Make printing handles from gdb a little easier because it doesn't always know how to locate the stdout or stderr globals from libc. With this commit `call uv_print_all_handles(0, 0)` prints the handles from the default loop to stderr. --- src/uv-common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/uv-common.c b/src/uv-common.c index 916f3f4e..2200fe3f 100644 --- a/src/uv-common.c +++ b/src/uv-common.c @@ -559,6 +559,9 @@ static void uv__print_handles(uv_loop_t* loop, int only_active, FILE* stream) { if (loop == NULL) loop = uv_default_loop(); + if (stream == NULL) + stream = stderr; + uv__queue_foreach(q, &loop->handle_queue) { h = uv__queue_data(q, uv_handle_t, handle_queue);