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