0005-nat-fork-inferior-include-linux-ptrace.h.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From fa319a6202cfe6e0415d28d6995019b18c16cd60 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  3. Date: Sun, 24 Jun 2018 23:33:55 +0200
  4. Subject: [PATCH] nat/fork-inferior: include linux-ptrace.h
  5. To decide whether fork() or vfork() should be used, fork-inferior.c
  6. uses the following test:
  7. #if !(defined(__UCLIBC__) && defined(HAS_NOMMU))
  8. However, HAS_NOMMU is never defined, because it gets defined in
  9. linux-ptrace.h, which is not included by fork-inferior.c. Due to this,
  10. gdbserver fails to build on noMMU architectures. This commit fixes
  11. that by simply including linux-ptrace.h.
  12. This bug was introduced by commit
  13. 2090129c36c7e582943b7d300968d19b46160d84 ("Share fork_inferior et al
  14. with gdbserver"). Indeed, the same fork()/vfork() selection was done,
  15. but in another file where linux-ptrace.h was included.
  16. Fixes the following build issue:
  17. ../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*))':
  18. ../nat/fork-inferior.c:376:11: error: 'fork' was not declared in this scope
  19. pid = fork ();
  20. ^~~~
  21. ../nat/fork-inferior.c:376:11: note: suggested alternative: 'vfork'
  22. pid = fork ();
  23. ^~~~
  24. vfork
  25. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  26. ---
  27. gdb/nat/fork-inferior.c | 1 +
  28. 1 file changed, 1 insertion(+)
  29. diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c
  30. index ea71aad25f7..77b9e03878b 100644
  31. --- a/gdb/nat/fork-inferior.c
  32. +++ b/gdb/nat/fork-inferior.c
  33. @@ -26,6 +26,7 @@
  34. #include "common-gdbthread.h"
  35. #include "signals-state-save-restore.h"
  36. #include "gdb_tilde_expand.h"
  37. +#include "linux-ptrace.h"
  38. #include <vector>
  39. extern char **environ;
  40. --
  41. 2.14.4