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