1 From 140bf80050b34f0947b34dba93b830ea2bfc5040 Mon Sep 17 00:00:00 2001
2 From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 Date: Thu, 25 Aug 2016 08:42:03 +0100
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 Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
58 gdb/ChangeLog | 14 ++++++++++++++
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/ChangeLog | 15 +++++++++++++++
64 gdb/gdbserver/gdb_proc_service.h | 2 +-
65 gdb/gdbserver/linux-aarch64-low.c | 2 +-
66 gdb/gdbserver/linux-arm-low.c | 2 +-
67 gdb/gdbserver/linux-crisv32-low.c | 2 +-
68 gdb/gdbserver/linux-m68k-low.c | 2 +-
69 gdb/gdbserver/linux-mips-low.c | 2 +-
70 gdb/gdbserver/linux-nios2-low.c | 2 +-
71 gdb/gdbserver/linux-tic6x-low.c | 2 +-
72 gdb/gdbserver/linux-x86-low.c | 2 +-
73 gdb/gdbserver/linux-xtensa-low.c | 2 +-
74 gdb/i386-linux-nat.c | 2 +-
75 gdb/m68klinux-nat.c | 2 +-
76 gdb/mips-linux-nat.c | 2 +-
77 gdb/nat/aarch64-linux.c | 2 +-
78 gdb/nat/aarch64-linux.h | 2 +-
79 gdb/xtensa-linux-nat.c | 2 +-
80 22 files changed, 49 insertions(+), 20 deletions(-)
82 diff --git a/gdb/ChangeLog b/gdb/ChangeLog
83 index 9b6562502e..a03afdb82f 100644
87 +2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org>
89 + * aarch64-linux-nat.c (ps_get_thread_area): Remove const from
90 + struct ps_prochandle.
91 + * amd64-linux-nat.c (ps_get_thread_area): Likewise.
92 + * arm-linux-nat.c (ps_get_thread_area): Likewise.
93 + * gdb_proc_service.h (ps_get_thread_area): Likewise.
94 + * i386-linux-nat.c (ps_get_thread_area): Likewise.
95 + * m68klinux-nat.c (ps_get_thread_area): Likewise.
96 + * mips-linux-nat.c (ps_get_thread_area): Likewise.
97 + * nat/aarch64-linux.c (aarch64_ps_get_thread_area): Likewise.
98 + * nat/aarch64-linux.h (aarch64_ps_get_thread_area): Likewise.
99 + * xtensa-linux-nat.c (ps_get_thread_area): Likewise.
101 2016-06-01 Joel Brobecker <brobecker@adacore.com>
103 * version.in: Set GDB version number to 7.11.1.DATE-git.
104 diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
105 index fe1631dbbb..5166eebd33 100644
106 --- a/gdb/aarch64-linux-nat.c
107 +++ b/gdb/aarch64-linux-nat.c
108 @@ -457,7 +457,7 @@ aarch64_linux_new_fork (struct lwp_info *parent, pid_t child_pid)
109 storage (or its descriptor). */
112 -ps_get_thread_area (const struct ps_prochandle *ph,
113 +ps_get_thread_area (struct ps_prochandle *ph,
114 lwpid_t lwpid, int idx, void **base)
117 diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
118 index 391a646992..9da36fd1ba 100644
119 --- a/gdb/amd64-linux-nat.c
120 +++ b/gdb/amd64-linux-nat.c
121 @@ -245,7 +245,7 @@ amd64_linux_store_inferior_registers (struct target_ops *ops,
122 a request for a thread's local storage address. */
125 -ps_get_thread_area (const struct ps_prochandle *ph,
126 +ps_get_thread_area (struct ps_prochandle *ph,
127 lwpid_t lwpid, int idx, void **base)
129 if (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 32)
130 diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
131 index d77ca93498..d11bdc6e22 100644
132 --- a/gdb/arm-linux-nat.c
133 +++ b/gdb/arm-linux-nat.c
134 @@ -477,7 +477,7 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
135 /* Fetch the thread-local storage pointer for libthread_db. */
138 -ps_get_thread_area (const struct ps_prochandle *ph,
139 +ps_get_thread_area (struct ps_prochandle *ph,
140 lwpid_t lwpid, int idx, void **base)
142 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
143 diff --git a/gdb/gdb_proc_service.h b/gdb/gdb_proc_service.h
144 index 04d3c03884..a1a8eb5b2f 100644
145 --- a/gdb/gdb_proc_service.h
146 +++ b/gdb/gdb_proc_service.h
147 @@ -124,7 +124,7 @@ extern pid_t ps_getpid (struct ps_prochandle *);
148 /* Fetch the special per-thread address associated with the given LWP.
149 This call is only used on a few platforms (most use a normal register).
150 The meaning of the `int' parameter is machine-dependent. */
151 -extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
152 +extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
153 lwpid_t, int, psaddr_t *);
156 diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
157 index 08fef5b06e..ea278b1250 100644
158 --- a/gdb/gdbserver/ChangeLog
159 +++ b/gdb/gdbserver/ChangeLog
161 +2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org>
164 + * gdb_proc_service.h (ps_get_thread_area): Remove const from struct
166 + * linux-aarch64-low.c (ps_get_thread_area): Likewise.
167 + * linux-arm-low.c (ps_get_thread_area): Likewise.
168 + * linux-crisv32-low.c (ps_get_thread_area): Likewise.
169 + * linux-m68k-low.c (ps_get_thread_area): Likewise.
170 + * linux-mips-low.c (ps_get_thread_area): Likewise.
171 + * linux-nios2-low.c (ps_get_thread_area): Likewise.
172 + * linux-tic6x-low.c (ps_get_thread_area): Likewise.
173 + * linux-x86-low.c (ps_get_thread_area): Likewise.
174 + * linux-xtensa-low.c (ps_get_thread_area): Likewise.
176 2016-04-15 Pedro Alves <palves@redhat.com>
178 * linux-low.c (check_stopped_by_breakpoint): Rename to ...
179 diff --git a/gdb/gdbserver/gdb_proc_service.h b/gdb/gdbserver/gdb_proc_service.h
180 index 99bf226b01..cec9231ee5 100644
181 --- a/gdb/gdbserver/gdb_proc_service.h
182 +++ b/gdb/gdbserver/gdb_proc_service.h
183 @@ -107,7 +107,7 @@ extern pid_t ps_getpid (struct ps_prochandle *);
184 /* Fetch the special per-thread address associated with the given LWP.
185 This call is only used on a few platforms (most use a normal register).
186 The meaning of the `int' parameter is machine-dependent. */
187 -extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
188 +extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
189 lwpid_t, int, psaddr_t *);
192 diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
193 index 806a76260f..b86f210390 100644
194 --- a/gdb/gdbserver/linux-aarch64-low.c
195 +++ b/gdb/gdbserver/linux-aarch64-low.c
196 @@ -421,7 +421,7 @@ aarch64_stopped_by_watchpoint (void)
197 /* Fetch the thread-local storage pointer for libthread_db. */
200 -ps_get_thread_area (const struct ps_prochandle *ph,
201 +ps_get_thread_area (struct ps_prochandle *ph,
202 lwpid_t lwpid, int idx, void **base)
204 return aarch64_ps_get_thread_area (ph, lwpid, idx, base,
205 diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
206 index 0f627069e0..9f043878c7 100644
207 --- a/gdb/gdbserver/linux-arm-low.c
208 +++ b/gdb/gdbserver/linux-arm-low.c
209 @@ -269,7 +269,7 @@ get_next_pcs_read_memory_unsigned_integer (CORE_ADDR memaddr,
210 /* Fetch the thread-local storage pointer for libthread_db. */
213 -ps_get_thread_area (const struct ps_prochandle *ph,
214 +ps_get_thread_area (struct ps_prochandle *ph,
215 lwpid_t lwpid, int idx, void **base)
217 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
218 diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
219 index 16c1f72015..fea6d5bf9b 100644
220 --- a/gdb/gdbserver/linux-crisv32-low.c
221 +++ b/gdb/gdbserver/linux-crisv32-low.c
222 @@ -309,7 +309,7 @@ cris_stopped_data_address (void)
226 -ps_get_thread_area (const struct ps_prochandle *ph,
227 +ps_get_thread_area (struct ps_prochandle *ph,
228 lwpid_t lwpid, int idx, void **base)
230 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
231 diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdb/gdbserver/linux-m68k-low.c
232 index df3d7c6d9c..78a340fa8f 100644
233 --- a/gdb/gdbserver/linux-m68k-low.c
234 +++ b/gdb/gdbserver/linux-m68k-low.c
235 @@ -152,7 +152,7 @@ m68k_breakpoint_at (CORE_ADDR pc)
236 /* Fetch the thread-local storage pointer for libthread_db. */
239 -ps_get_thread_area (const struct ps_prochandle *ph,
240 +ps_get_thread_area (struct ps_prochandle *ph,
241 lwpid_t lwpid, int idx, void **base)
243 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
244 diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
245 index 30a03d5f43..9356bb3d99 100644
246 --- a/gdb/gdbserver/linux-mips-low.c
247 +++ b/gdb/gdbserver/linux-mips-low.c
248 @@ -637,7 +637,7 @@ mips_stopped_data_address (void)
249 /* Fetch the thread-local storage pointer for libthread_db. */
252 -ps_get_thread_area (const struct ps_prochandle *ph,
253 +ps_get_thread_area (struct ps_prochandle *ph,
254 lwpid_t lwpid, int idx, void **base)
256 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
257 diff --git a/gdb/gdbserver/linux-nios2-low.c b/gdb/gdbserver/linux-nios2-low.c
258 index ea0ded1f1e..98a85ed8e3 100644
259 --- a/gdb/gdbserver/linux-nios2-low.c
260 +++ b/gdb/gdbserver/linux-nios2-low.c
261 @@ -145,7 +145,7 @@ nios2_breakpoint_at (CORE_ADDR where)
262 /* Fetch the thread-local storage pointer for libthread_db. */
265 -ps_get_thread_area (const struct ps_prochandle *ph,
266 +ps_get_thread_area (struct ps_prochandle *ph,
267 lwpid_t lwpid, int idx, void **base)
269 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
270 diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdb/gdbserver/linux-tic6x-low.c
271 index e40a3aff51..6b90560dc4 100644
272 --- a/gdb/gdbserver/linux-tic6x-low.c
273 +++ b/gdb/gdbserver/linux-tic6x-low.c
274 @@ -274,7 +274,7 @@ tic6x_breakpoint_at (CORE_ADDR where)
275 /* Fetch the thread-local storage pointer for libthread_db. */
278 -ps_get_thread_area (const struct ps_prochandle *ph,
279 +ps_get_thread_area (struct ps_prochandle *ph,
280 lwpid_t lwpid, int idx, void **base)
282 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
283 diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
284 index 0c4954a58d..8bac10a54b 100644
285 --- a/gdb/gdbserver/linux-x86-low.c
286 +++ b/gdb/gdbserver/linux-x86-low.c
287 @@ -236,7 +236,7 @@ is_64bit_tdesc (void)
288 /* Called by libthread_db. */
291 -ps_get_thread_area (const struct ps_prochandle *ph,
292 +ps_get_thread_area (struct ps_prochandle *ph,
293 lwpid_t lwpid, int idx, void **base)
296 diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c
297 index 6e945eac17..431082c01f 100644
298 --- a/gdb/gdbserver/linux-xtensa-low.c
299 +++ b/gdb/gdbserver/linux-xtensa-low.c
300 @@ -177,7 +177,7 @@ xtensa_breakpoint_at (CORE_ADDR where)
301 /* Called by libthread_db. */
304 -ps_get_thread_area (const struct ps_prochandle *ph,
305 +ps_get_thread_area (struct ps_prochandle *ph,
306 lwpid_t lwpid, int idx, void **base)
308 xtensa_elf_gregset_t regs;
309 diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
310 index a41ee21081..70d954fdc0 100644
311 --- a/gdb/i386-linux-nat.c
312 +++ b/gdb/i386-linux-nat.c
313 @@ -603,7 +603,7 @@ i386_linux_store_inferior_registers (struct target_ops *ops,
314 storage (or its descriptor). */
317 -ps_get_thread_area (const struct ps_prochandle *ph,
318 +ps_get_thread_area (struct ps_prochandle *ph,
319 lwpid_t lwpid, int idx, void **base)
321 unsigned int base_addr;
322 diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c
323 index 24b6242ba3..5b8684b719 100644
324 --- a/gdb/m68klinux-nat.c
325 +++ b/gdb/m68klinux-nat.c
326 @@ -508,7 +508,7 @@ m68k_linux_store_inferior_registers (struct target_ops *ops,
327 /* Fetch the thread-local storage pointer for libthread_db. */
330 -ps_get_thread_area (const struct ps_prochandle *ph,
331 +ps_get_thread_area (struct ps_prochandle *ph,
332 lwpid_t lwpid, int idx, void **base)
334 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) < 0)
335 diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
336 index bfe9fcbe68..0f20f16814 100644
337 --- a/gdb/mips-linux-nat.c
338 +++ b/gdb/mips-linux-nat.c
339 @@ -152,7 +152,7 @@ mips64_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
340 /* Fetch the thread-local storage pointer for libthread_db. */
343 -ps_get_thread_area (const struct ps_prochandle *ph,
344 +ps_get_thread_area (struct ps_prochandle *ph,
345 lwpid_t lwpid, int idx, void **base)
347 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
348 diff --git a/gdb/nat/aarch64-linux.c b/gdb/nat/aarch64-linux.c
349 index 5ae5aa8602..1828977e28 100644
350 --- a/gdb/nat/aarch64-linux.c
351 +++ b/gdb/nat/aarch64-linux.c
352 @@ -205,7 +205,7 @@ aarch64_siginfo_from_compat_siginfo (siginfo_t *to, compat_siginfo_t *from)
353 storage (or its descriptor). */
356 -aarch64_ps_get_thread_area (const struct ps_prochandle *ph,
357 +aarch64_ps_get_thread_area (struct ps_prochandle *ph,
358 lwpid_t lwpid, int idx, void **base,
361 diff --git a/gdb/nat/aarch64-linux.h b/gdb/nat/aarch64-linux.h
362 index 7221982b78..aac7c68c06 100644
363 --- a/gdb/nat/aarch64-linux.h
364 +++ b/gdb/nat/aarch64-linux.h
365 @@ -122,7 +122,7 @@ void aarch64_linux_prepare_to_resume (struct lwp_info *lwp);
367 void aarch64_linux_new_thread (struct lwp_info *lwp);
369 -ps_err_e aarch64_ps_get_thread_area (const struct ps_prochandle *ph,
370 +ps_err_e aarch64_ps_get_thread_area (struct ps_prochandle *ph,
371 lwpid_t lwpid, int idx, void **base,
374 diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
375 index 54da83791a..836d3f80ee 100644
376 --- a/gdb/xtensa-linux-nat.c
377 +++ b/gdb/xtensa-linux-nat.c
378 @@ -286,7 +286,7 @@ xtensa_linux_store_inferior_registers (struct target_ops *ops,
379 /* Called by libthread_db. */
382 -ps_get_thread_area (const struct ps_prochandle *ph,
383 +ps_get_thread_area (struct ps_prochandle *ph,
384 lwpid_t lwpid, int idx, void **base)
386 xtensa_elf_gregset_t regs;