From patchwork Fri Aug 29 13:51:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 2592 Received: (qmail 29183 invoked by alias); 29 Aug 2014 13:59:30 -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 29168 invoked by uid 89); 29 Aug 2014 13:59:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 29 Aug 2014 13:59:28 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7TDpnP4020637 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 Aug 2014 09:51:49 -0400 Received: from blade.nx (ovpn-116-113.ams2.redhat.com [10.36.116.113]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7TDpmBw016374; Fri, 29 Aug 2014 09:51:49 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 9E5482640F2; Fri, 29 Aug 2014 14:51:44 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Cc: Pedro Alves , Doug Evans Subject: [PATCH 9/9 v7] Remove one GDBSERVER use from linux-waitpid.c Date: Fri, 29 Aug 2014 14:51:39 +0100 Message-Id: <1409320299-6812-10-git-send-email-gbenson@redhat.com> In-Reply-To: <1409320299-6812-1-git-send-email-gbenson@redhat.com> References: <1409320299-6812-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes This commit makes nat/linux-waitpid.c include common-defs.h rather than defs.h or server.h. Some debug code previously only built for gdbserver is now also built for GDB, and a use of GDBSERVER has had to remain in order to select the variable used to determine whether debug printing should be enabled. This patch differs from the version I posted on August 1 (https://sourceware.org/ml/gdb-patches/2014-08/msg00016.html) in that previously debug printing was only built for gdbserver (enabled when debug_threads is set) but now it is also built for GDB (enabled when debug_linux_nat is set). I had to make debug_linux_nat nonstatic to do this. gdb/ChangeLog: * linux-nat.c (debug_linux_nat): Make nonstatic. * nat/linux-waitpid.c: Include common-defs.h. Don't include defs.h, server.h or signal.h. (debug_linux_waitpid): New macro and extern. (linux_debug): Use debug_linux_waitpid and debug_vprintf. --- gdb/ChangeLog | 8 ++++++++ gdb/linux-nat.c | 3 ++- gdb/nat/linux-waitpid.c | 25 +++++++++++++------------ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 0898442..2e0aedc 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -204,7 +204,8 @@ static target_xfer_partial_ftype *super_xfer_partial; Called by our to_close. */ static void (*super_close) (struct target_ops *); -static unsigned int debug_linux_nat; +unsigned int debug_linux_nat; + static void show_debug_linux_nat (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) diff --git a/gdb/nat/linux-waitpid.c b/gdb/nat/linux-waitpid.c index 53847ac..7fea870 100644 --- a/gdb/nat/linux-waitpid.c +++ b/gdb/nat/linux-waitpid.c @@ -17,16 +17,20 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "common-defs.h" +#include "linux-nat.h" +#include "linux-waitpid.h" +#include "gdb_wait.h" + +/* FIXME: Need a common variable to select Linux debug output. */ + #ifdef GDBSERVER -#include "server.h" +#define debug_linux_waitpid debug_threads #else -#include "defs.h" -#include "signal.h" +#define debug_linux_waitpid debug_linux_nat #endif -#include "linux-nat.h" -#include "linux-waitpid.h" -#include "gdb_wait.h" +extern int debug_linux_waitpid; /* Print debugging output based on the format string FORMAT and its parameters. */ @@ -34,17 +38,14 @@ static inline void linux_debug (const char *format, ...) { -#ifdef GDBSERVER - if (debug_threads) + if (debug_linux_waitpid) { va_list args; + va_start (args, format); - vfprintf (stderr, format, args); + debug_vprintf (format, args); va_end (args); } -#else - /* GDB-specific debugging output. */ -#endif } /* Convert wait status STATUS to a string. Used for printing debug