public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] nat/fork-inferior: include linux-ptrace.h
@ 2018-06-25  8:05 Thomas Petazzoni
  2018-06-27 14:25 ` Simon Marchi
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2018-06-25  8:05 UTC (permalink / raw)
  To: gdb-patches; +Cc: Thomas Petazzoni

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;
-- 
2.14.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-06-27 16:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-25  8:05 [PATCH] nat/fork-inferior: include linux-ptrace.h Thomas Petazzoni
2018-06-27 14:25 ` Simon Marchi
2018-06-27 14:30   ` Pedro Alves
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

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).