From patchwork Wed Jun 19 09:29:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 33205 Received: (qmail 104001 invoked by alias); 19 Jun 2019 09:30:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 103979 invoked by uid 89); 19 Jun 2019 09:30:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Jun 2019 09:29:59 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9B15AADCF; Wed, 19 Jun 2019 09:29:56 +0000 (UTC) Subject: Re: [PATCH 3/4] gdbserver: Ensure all debug output uses debug functions To: Tom Tromey , Alan Hayward Cc: "gdb-patches@sourceware.org" , nd References: <20190416101729.16176-1-alan.hayward@arm.com> <20190416101729.16176-4-alan.hayward@arm.com> <87sguhsplu.fsf@tromey.com> From: Tom de Vries Message-ID: <8e0c4e58-abc3-d078-1628-2297e4e7d4d7@suse.de> Date: Wed, 19 Jun 2019 11:29:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <87sguhsplu.fsf@tromey.com> X-IsSubscribed: yes On 16-04-19 21:43, Tom Tromey wrote: >>>>>> "Alan" == Alan Hayward 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> * nat/linux-waitpid.c (linux_debug): Call debug_vprintf. > > Alan> gdb/gdbserver/ChangeLog: > > Alan> 2019-04-16 Alan Hayward > > 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