[3/4] gdbserver: Ensure all debug output uses debug functions
Commit Message
On 16-04-19 21:43, Tom Tromey wrote:
>>>>>> "Alan" == Alan Hayward <Alan.Hayward@arm.com> writes:
>
> Alan> All debug output needs to go via debug functions to ensure it writes to the
> Alan> correct output stream.
>
> Alan> gdb/ChangeLog:
>
> Alan> 2019-04-16 Alan Hayward <alan.hayward@arm.com>
>
> Alan> * nat/linux-waitpid.c (linux_debug): Call debug_vprintf.
>
> Alan> gdb/gdbserver/ChangeLog:
>
> Alan> 2019-04-16 Alan Hayward <alan.hayward@arm.com>
>
> Alan> * ax.c (ax_vdebug): Call debug_printf.
> Alan> * debug.c (debug_write): New function.
> Alan> * debug.h (debug_write): New declaration.
> Alan> * linux-low.c (sigchld_handler): Call debug_write.
>
Building gdb with clang, I run into:
...
src/gdb/gdbserver/linux-low.c:6190:41: error: comparison of unsigned
expression < 0 is always false [-Werror,-Wtautological-compare]
sizeof ("sigchld_handler\n") - 1) < 0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
...
This seems to fix it.
Thanks,
- Tom
Comments
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> This seems to fix it.
This needs a ChangeLog entry but is otherwise ok. Thanks.
Tom
@@ -133,7 +133,7 @@ do_debug_exit (const char *function_name)
/* See debug.h. */
-size_t
+ssize_t
debug_write (const void *buf, size_t nbyte)
{
int fd = fileno (debug_file);
@@ -36,7 +36,7 @@ void do_debug_enter (const char *function_name);
void do_debug_exit (const char *function_name);
/* Async signal safe debug output function that calls write directly. */
-size_t debug_write (const void *buf, size_t nbyte);
+ssize_t debug_write (const void *buf, size_t nbyte);
/* These macros are for use in major functions that produce a lot of
debugging output. They help identify in the mass of debugging output