1 From ccc18e0b2dc77a6619df31fd4fadfb3a37401616 Mon Sep 17 00:00:00 2001
2 From: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>
3 Date: Sun, 26 Mar 2017 23:06:45 +0200
4 Subject: [PATCH] Sync proc_service definition with GLIBC
6 GLIBC BZ#20311 [1] proc_service.h install patch also remove 'const'
7 attributes from ps_get_thread_area and comment #15 discuss why to remove
8 the const attribute (basically since it a callback with the struct
9 ps_prochandle owned by the client it should be able to modify it if
12 On default build this is not the issue and current g++ does not trigger
13 any issue with this mismatch declaration. However, on some bootstrap
14 build configuration where gdbserver is build with gcc instead this
17 error: conflicting types for 'ps_get_thread_area'
19 This patch fixes it by syncing the declaration with GLIBC.
21 [1] https://sourceware.org/bugzilla/show_bug.cgi?id=20311
25 2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org>
27 * aarch64-linux-nat.c (ps_get_thread_area): Remove const from
29 * amd64-linux-nat.c (ps_get_thread_area): Likewise.
30 * arm-linux-nat.c (ps_get_thread_area): Likewise.
31 * gdb_proc_service.h (ps_get_thread_area): Likewise.
32 * i386-linux-nat.c (ps_get_thread_area): Likewise.
33 * m68klinux-nat.c (ps_get_thread_area): Likewise.
34 * mips-linux-nat.c (ps_get_thread_area): Likewise.
35 * nat/aarch64-linux.c (aarch64_ps_get_thread_area): Likewise.
36 * nat/aarch64-linux.h (aarch64_ps_get_thread_area): Likewise.
37 * xtensa-linux-nat.c (ps_get_thread_area): Likewise.
39 gdb/gdbserver/ChangeLog:
41 2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org>
44 * gdb_proc_service.h (ps_get_thread_area): Remove const from struct
46 * linux-aarch64-low.c (ps_get_thread_area): Likewise.
47 * linux-arm-low.c (ps_get_thread_area): Likewise.
48 * linux-crisv32-low.c (ps_get_thread_area): Likewise.
49 * linux-m68k-low.c (ps_get_thread_area): Likewise.
50 * linux-mips-low.c (ps_get_thread_area): Likewise.
51 * linux-nios2-low.c (ps_get_thread_area): Likewise.
52 * linux-tic6x-low.c (ps_get_thread_area): Likewise.
53 * linux-x86-low.c (ps_get_thread_area): Likewise.
54 * linux-xtensa-low.c (ps_get_thread_area): Likewise.
56 (cherry picked from commit 140bf80050b34f0947b34dba93b830ea2bfc5040)
57 Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
59 gdb/aarch64-linux-nat.c | 2 +-
60 gdb/amd64-linux-nat.c | 2 +-
61 gdb/arm-linux-nat.c | 2 +-
62 gdb/gdb_proc_service.h | 2 +-
63 gdb/gdbserver/gdb_proc_service.h | 2 +-
64 gdb/gdbserver/linux-aarch64-low.c | 2 +-
65 gdb/gdbserver/linux-arm-low.c | 2 +-
66 gdb/gdbserver/linux-crisv32-low.c | 2 +-
67 gdb/gdbserver/linux-m68k-low.c | 2 +-
68 gdb/gdbserver/linux-mips-low.c | 2 +-
69 gdb/gdbserver/linux-nios2-low.c | 2 +-
70 gdb/gdbserver/linux-tic6x-low.c | 2 +-
71 gdb/gdbserver/linux-x86-low.c | 2 +-
72 gdb/i386-linux-nat.c | 2 +-
73 gdb/m68klinux-nat.c | 2 +-
74 gdb/mips-linux-nat.c | 2 +-
75 16 files changed, 16 insertions(+), 16 deletions(-)
77 diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
78 index 9959b81a2d..aa0f8d76bd 100644
79 --- a/gdb/aarch64-linux-nat.c
80 +++ b/gdb/aarch64-linux-nat.c
81 @@ -734,7 +734,7 @@ aarch64_linux_new_fork (struct lwp_info *parent, pid_t child_pid)
82 storage (or its descriptor). */
85 -ps_get_thread_area (const struct ps_prochandle *ph,
86 +ps_get_thread_area (struct ps_prochandle *ph,
87 lwpid_t lwpid, int idx, void **base)
90 diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
91 index 2e1b081b0f..7f076a9148 100644
92 --- a/gdb/amd64-linux-nat.c
93 +++ b/gdb/amd64-linux-nat.c
94 @@ -244,7 +244,7 @@ amd64_linux_store_inferior_registers (struct target_ops *ops,
95 a request for a thread's local storage address. */
98 -ps_get_thread_area (const struct ps_prochandle *ph,
99 +ps_get_thread_area (struct ps_prochandle *ph,
100 lwpid_t lwpid, int idx, void **base)
102 if (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 32)
103 diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
104 index c167bce18b..8462655139 100644
105 --- a/gdb/arm-linux-nat.c
106 +++ b/gdb/arm-linux-nat.c
107 @@ -778,7 +778,7 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
108 /* Fetch the thread-local storage pointer for libthread_db. */
111 -ps_get_thread_area (const struct ps_prochandle *ph,
112 +ps_get_thread_area (struct ps_prochandle *ph,
113 lwpid_t lwpid, int idx, void **base)
115 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
116 diff --git a/gdb/gdb_proc_service.h b/gdb/gdb_proc_service.h
117 index e7369911a1..91fbc29a76 100644
118 --- a/gdb/gdb_proc_service.h
119 +++ b/gdb/gdb_proc_service.h
120 @@ -124,7 +124,7 @@ extern pid_t ps_getpid (struct ps_prochandle *);
121 /* Fetch the special per-thread address associated with the given LWP.
122 This call is only used on a few platforms (most use a normal register).
123 The meaning of the `int' parameter is machine-dependent. */
124 -extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
125 +extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
126 lwpid_t, int, psaddr_t *);
129 diff --git a/gdb/gdbserver/gdb_proc_service.h b/gdb/gdbserver/gdb_proc_service.h
130 index cbafbf3206..7f9b1e4de0 100644
131 --- a/gdb/gdbserver/gdb_proc_service.h
132 +++ b/gdb/gdbserver/gdb_proc_service.h
133 @@ -107,7 +107,7 @@ extern pid_t ps_getpid (struct ps_prochandle *);
134 /* Fetch the special per-thread address associated with the given LWP.
135 This call is only used on a few platforms (most use a normal register).
136 The meaning of the `int' parameter is machine-dependent. */
137 -extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
138 +extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
139 lwpid_t, int, psaddr_t *);
142 diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
143 index 8a30b00029..a0ac35620d 100644
144 --- a/gdb/gdbserver/linux-aarch64-low.c
145 +++ b/gdb/gdbserver/linux-aarch64-low.c
146 @@ -1089,7 +1089,7 @@ aarch64_stopped_by_watchpoint (void)
147 /* Fetch the thread-local storage pointer for libthread_db. */
150 -ps_get_thread_area (const struct ps_prochandle *ph,
151 +ps_get_thread_area (struct ps_prochandle *ph,
152 lwpid_t lwpid, int idx, void **base)
155 diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
156 index dd77b48ecd..560e7d8496 100644
157 --- a/gdb/gdbserver/linux-arm-low.c
158 +++ b/gdb/gdbserver/linux-arm-low.c
159 @@ -334,7 +334,7 @@ arm_reinsert_addr (void)
160 /* Fetch the thread-local storage pointer for libthread_db. */
163 -ps_get_thread_area (const struct ps_prochandle *ph,
164 +ps_get_thread_area (struct ps_prochandle *ph,
165 lwpid_t lwpid, int idx, void **base)
167 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
168 diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
169 index 65e6c09df2..fd5e627123 100644
170 --- a/gdb/gdbserver/linux-crisv32-low.c
171 +++ b/gdb/gdbserver/linux-crisv32-low.c
172 @@ -336,7 +336,7 @@ cris_stopped_data_address (void)
176 -ps_get_thread_area (const struct ps_prochandle *ph,
177 +ps_get_thread_area (struct ps_prochandle *ph,
178 lwpid_t lwpid, int idx, void **base)
180 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
181 diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdb/gdbserver/linux-m68k-low.c
182 index 4501904e39..7415930360 100644
183 --- a/gdb/gdbserver/linux-m68k-low.c
184 +++ b/gdb/gdbserver/linux-m68k-low.c
185 @@ -160,7 +160,7 @@ m68k_breakpoint_at (CORE_ADDR pc)
186 /* Fetch the thread-local storage pointer for libthread_db. */
189 -ps_get_thread_area (const struct ps_prochandle *ph,
190 +ps_get_thread_area (struct ps_prochandle *ph,
191 lwpid_t lwpid, int idx, void **base)
193 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
194 diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
195 index 1695c4cf0d..acc2468bce 100644
196 --- a/gdb/gdbserver/linux-mips-low.c
197 +++ b/gdb/gdbserver/linux-mips-low.c
198 @@ -640,7 +640,7 @@ mips_stopped_data_address (void)
199 /* Fetch the thread-local storage pointer for libthread_db. */
202 -ps_get_thread_area (const struct ps_prochandle *ph,
203 +ps_get_thread_area (struct ps_prochandle *ph,
204 lwpid_t lwpid, int idx, void **base)
206 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
207 diff --git a/gdb/gdbserver/linux-nios2-low.c b/gdb/gdbserver/linux-nios2-low.c
208 index 7bd3c9795d..719883edef 100644
209 --- a/gdb/gdbserver/linux-nios2-low.c
210 +++ b/gdb/gdbserver/linux-nios2-low.c
211 @@ -150,7 +150,7 @@ nios2_breakpoint_at (CORE_ADDR where)
212 /* Fetch the thread-local storage pointer for libthread_db. */
215 -ps_get_thread_area (const struct ps_prochandle *ph,
216 +ps_get_thread_area (struct ps_prochandle *ph,
217 lwpid_t lwpid, int idx, void **base)
219 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
220 diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdb/gdbserver/linux-tic6x-low.c
221 index 0a0d220c34..26c4dee999 100644
222 --- a/gdb/gdbserver/linux-tic6x-low.c
223 +++ b/gdb/gdbserver/linux-tic6x-low.c
224 @@ -266,7 +266,7 @@ tic6x_breakpoint_at (CORE_ADDR where)
225 /* Fetch the thread-local storage pointer for libthread_db. */
228 -ps_get_thread_area (const struct ps_prochandle *ph,
229 +ps_get_thread_area (struct ps_prochandle *ph,
230 lwpid_t lwpid, int idx, void **base)
232 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
233 diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
234 index 484eadba05..15f25d71d5 100644
235 --- a/gdb/gdbserver/linux-x86-low.c
236 +++ b/gdb/gdbserver/linux-x86-low.c
237 @@ -231,7 +231,7 @@ is_64bit_tdesc (void)
238 /* Called by libthread_db. */
241 -ps_get_thread_area (const struct ps_prochandle *ph,
242 +ps_get_thread_area (struct ps_prochandle *ph,
243 lwpid_t lwpid, int idx, void **base)
246 diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
247 index 349ce68f5c..80d6a516ea 100644
248 --- a/gdb/i386-linux-nat.c
249 +++ b/gdb/i386-linux-nat.c
250 @@ -603,7 +603,7 @@ i386_linux_store_inferior_registers (struct target_ops *ops,
251 storage (or its descriptor). */
254 -ps_get_thread_area (const struct ps_prochandle *ph,
255 +ps_get_thread_area (struct ps_prochandle *ph,
256 lwpid_t lwpid, int idx, void **base)
258 unsigned int base_addr;
259 diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c
260 index 8f89d7b87a..6e528b4e91 100644
261 --- a/gdb/m68klinux-nat.c
262 +++ b/gdb/m68klinux-nat.c
263 @@ -508,7 +508,7 @@ m68k_linux_store_inferior_registers (struct target_ops *ops,
264 /* Fetch the thread-local storage pointer for libthread_db. */
267 -ps_get_thread_area (const struct ps_prochandle *ph,
268 +ps_get_thread_area (struct ps_prochandle *ph,
269 lwpid_t lwpid, int idx, void **base)
271 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) < 0)
272 diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
273 index a36bb6356f..9f6d6975a0 100644
274 --- a/gdb/mips-linux-nat.c
275 +++ b/gdb/mips-linux-nat.c
276 @@ -152,7 +152,7 @@ mips64_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
277 /* Fetch the thread-local storage pointer for libthread_db. */
280 -ps_get_thread_area (const struct ps_prochandle *ph,
281 +ps_get_thread_area (struct ps_prochandle *ph,
282 lwpid_t lwpid, int idx, void **base)
284 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)