From a7e559cc087b10b9ea337b58e52cc13964aae3fb Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Tue, 16 Apr 2019 10:37:47 +0100 Subject: gdbserver: Ensure all debug output uses debug functions All debug output needs to go via debug functions to ensure it writes to the correct output stream. gdb/ChangeLog: * nat/linux-waitpid.c (linux_debug): Call debug_vprintf. gdb/gdbserver/ChangeLog: * ax.c (ax_vdebug): Call debug_printf. * debug.c (debug_write): New function. * debug.h (debug_write): New declaration. * linux-low.c (sigchld_handler): Call debug_write. --- gdb/gdbserver/linux-low.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'gdb/gdbserver/linux-low.c') diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 168f4b2..917b1c2 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -6185,10 +6185,9 @@ sigchld_handler (int signo) { do { - /* fprintf is not async-signal-safe, so call write - directly. */ - if (write (2, "sigchld_handler\n", - sizeof ("sigchld_handler\n") - 1) < 0) + /* Use the async signal safe debug function. */ + if (debug_write ("sigchld_handler\n", + sizeof ("sigchld_handler\n") - 1) < 0) break; /* just ignore */ } while (0); } -- cgit v1.1