From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] nat/fork-inferior: include linux-ptrace.h
Date: Wed, 27 Jun 2018 14:30:00 -0000 [thread overview]
Message-ID: <e8f71c75-771c-6969-2073-f21d4d0fdb5e@redhat.com> (raw)
In-Reply-To: <3acce11a3e5ed352af945ab71739468b@polymtl.ca>
On 06/27/2018 03:24 PM, Simon Marchi wrote:
> 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 <thomas.petazzoni@bootlin.com>
>> ---
>> Â 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 <vector>
>>
>> Â 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.
Please don't. It seems very wrong to me to include this header on other hosts.
It is full of Linux-only details.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2018-06-27 14:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-25 8:05 Thomas Petazzoni
2018-06-27 14:25 ` Simon Marchi
2018-06-27 14:30 ` Pedro Alves [this message]
2018-06-27 14:31 ` Thomas Petazzoni
2018-06-27 14:34 ` Simon Marchi
2018-06-27 16:29 ` Joel Brobecker
2018-06-27 16:32 ` Pedro Alves
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=e8f71c75-771c-6969-2073-f21d4d0fdb5e@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
--cc=thomas.petazzoni@bootlin.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).