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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From d84ecfa3a8c8fbade89229ac66c09f2a97ab00fb 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. [Romain: rebase on gdb 8.3]
  27. Signed-off-by: Romain Naour <romain.naour@gmail.com>
  28. ---
  29. gdb/nat/fork-inferior.c | 1 +
  30. 1 file changed, 1 insertion(+)
  31. diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c
  32. index fe9360a5039..626fe7c1fbf 100644
  33. --- a/gdb/nat/fork-inferior.c
  34. +++ b/gdb/nat/fork-inferior.c
  35. @@ -27,6 +27,7 @@
  36. #include "common/pathstuff.h"
  37. #include "common/signals-state-save-restore.h"
  38. #include "common/gdb_tilde_expand.h"
  39. +#include "linux-ptrace.h"
  40. #include <vector>
  41. extern char **environ;
  42. --
  43. 2.21.0