From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37257 invoked by alias); 27 Jun 2018 14:25:06 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 36947 invoked by uid 89); 27 Jun 2018 14:24:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS,TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Jun 2018 14:24:25 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w5REO9RL001794 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 27 Jun 2018 10:24:14 -0400 Received: by simark.ca (Postfix, from userid 112) id 3C0E81EF29; Wed, 27 Jun 2018 10:24:09 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 7DC1A1E059; Wed, 27 Jun 2018 10:24:07 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 27 Jun 2018 14:25:00 -0000 From: Simon Marchi To: Thomas Petazzoni Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] nat/fork-inferior: include linux-ptrace.h In-Reply-To: <20180625080547.7629-1-thomas.petazzoni@bootlin.com> References: <20180625080547.7629-1-thomas.petazzoni@bootlin.com> Message-ID: <3acce11a3e5ed352af945ab71739468b@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00647.txt.bz2 On 2018-06-25 04:05, Thomas Petazzoni wrote: > To decide whether fork() or vfork() should be used, fork-inferior.c > uses the following test: > > #if !(defined(__UCLIBC__) && defined(HAS_NOMMU)) > > However, HAS_NOMMU is never defined, because it gets defined in > linux-ptrace.h, which is not included by fork-inferior.c. Due to this, > gdbserver fails to build on noMMU architectures. This commit fixes > that by simply including linux-ptrace.h. > > This bug was introduced by commit > 2090129c36c7e582943b7d300968d19b46160d84 ("Share fork_inferior et al > with gdbserver"). Indeed, the same fork()/vfork() selection was done, > but in another file where linux-ptrace.h was included. > > Fixes the following build issue: > > ../nat/fork-inferior.c: In function 'pid_t fork_inferior(const char*, > const string&, char**, void (*)(), void (*)(int), void (*)(), const > char*, void (*)(const char*, char* const*, char* const*))': > ../nat/fork-inferior.c:376:11: error: 'fork' was not declared in this > scope > pid = fork (); > ^~~~ > ../nat/fork-inferior.c:376:11: note: suggested alternative: 'vfork' > pid = fork (); > ^~~~ > vfork > > Signed-off-by: Thomas Petazzoni > --- > gdb/nat/fork-inferior.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c > index 8b59387fa5..05167628a6 100644 > --- a/gdb/nat/fork-inferior.c > +++ b/gdb/nat/fork-inferior.c > @@ -26,6 +26,7 @@ > #include "common-gdbthread.h" > #include "signals-state-save-restore.h" > #include "gdb_tilde_expand.h" > +#include "linux-ptrace.h" > #include > > extern char **environ; Hi Thomas, fork-inferior.c is also included in native builds for BSDs, AIX, Solaris and Darwin (see gdb/configure.nat). I am a bit concerned that linux-ptrace.h could use some Linux-specific things, and thus would break the other builds. However, I built-tested on FreeBSD and it seems fine. Worst case, we can probably wrap this include in "#ifdef __linux__" if that becomes a problem. Do you have push access, or do you prefer if I push the patch for you? I suppose that error was caught by a Buildroot autobuilder? Would it be possible to have the config, so I can add a similar configuration to my collection of cross-compiled GDB builds I use for build-testing? Thanks, Simon