Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>, Alan Hayward <Alan.Hayward@arm.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	nd <nd@arm.com>
Subject: Re: [PATCH 3/4] gdbserver: Ensure all debug output uses debug functions
Date: Wed, 19 Jun 2019 09:30:00 -0000	[thread overview]
Message-ID: <8e0c4e58-abc3-d078-1628-2297e4e7d4d7@suse.de> (raw)
In-Reply-To: <87sguhsplu.fsf@tromey.com>

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

diff --git a/gdb/gdbserver/debug.c b/gdb/gdbserver/debug.c
index a1cf5dbf7a..19f11fc17c 100644
--- a/gdb/gdbserver/debug.c
+++ b/gdb/gdbserver/debug.c
@@ -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);
diff --git a/gdb/gdbserver/debug.h b/gdb/gdbserver/debug.h
index 29e58ad8a4..07e94eac6e 100644
--- a/gdb/gdbserver/debug.h
+++ b/gdb/gdbserver/debug.h
@@ -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


  reply	other threads:[~2019-06-19  9:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190416101729.16176-1-alan.hayward@arm.com>
2019-04-16 10:17 ` [PATCH 2/4] gdbserver: Add debug-file option Alan Hayward
2019-04-16 19:39   ` Tom Tromey
     [not found]   ` <83o956ggdw.fsf@gnu.org>
2019-04-17  9:39     ` Alan Hayward
2019-04-16 14:44 ` [PATCH 0/4] gdbserver/testsuite : Capture gdbserver debug output during testing Eli Zaretskii
     [not found] ` <20190416101729.16176-2-alan.hayward@arm.com>
2019-04-16 19:31   ` [PATCH 1/4] gdbserver: Move remote_debug to a single place Tom Tromey
     [not found] ` <20190416101729.16176-4-alan.hayward@arm.com>
2019-04-16 19:43   ` [PATCH 3/4] gdbserver: Ensure all debug output uses debug functions Tom Tromey
2019-06-19  9:30     ` Tom de Vries [this message]
2019-06-19 13:17       ` Tom Tromey
     [not found] ` <20190416101729.16176-5-alan.hayward@arm.com>
2019-04-16 19:49   ` [PATCH 4/4] testsuite: Add option to capture gdbserver debug Tom Tromey
2019-04-17 15:43     ` Alan Hayward

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8e0c4e58-abc3-d078-1628-2297e4e7d4d7@suse.de \
    --to=tdevries@suse.de \
    --cc=Alan.Hayward@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.com \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox