diff options
author | Khem Raj <raj.khem@gmail.com> | 2021-12-07 11:24:53 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-12-08 20:22:11 +0000 |
commit | 14322fdeae969c8bd708ac2ec97bf527e8a705c2 (patch) | |
tree | d0b66333f6a81ec2dfc43c6481c63f2e10eb64a4 /meta/recipes-devtools | |
parent | 4e26e51a3d90790c8ade8817a2ba6f0b03f05c12 (diff) | |
download | poky-14322fdeae969c8bd708ac2ec97bf527e8a705c2.tar.gz |
gdb: Drop sh4 support patch
This patch needs to be upstreamed, its not clear if it still works.
(From OE-Core rev: 5a009e67a9e6549bab495363cc7434384a4c94c4)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/gdb/gdb-11.1.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch | 914 |
2 files changed, 0 insertions, 915 deletions
diff --git a/meta/recipes-devtools/gdb/gdb-11.1.inc b/meta/recipes-devtools/gdb/gdb-11.1.inc index a480997220..5364a880e3 100644 --- a/meta/recipes-devtools/gdb/gdb-11.1.inc +++ b/meta/recipes-devtools/gdb/gdb-11.1.inc | |||
@@ -8,7 +8,6 @@ SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.xz \ | |||
8 | file://0001-make-man-install-relative-to-DESTDIR.patch \ | 8 | file://0001-make-man-install-relative-to-DESTDIR.patch \ |
9 | file://0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch \ | 9 | file://0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch \ |
10 | file://0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch \ | 10 | file://0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch \ |
11 | file://0004-Add-support-for-Renesas-SH-sh4-architecture.patch \ | ||
12 | file://0005-Dont-disable-libreadline.a-when-using-disable-static.patch \ | 11 | file://0005-Dont-disable-libreadline.a-when-using-disable-static.patch \ |
13 | file://0006-use-asm-sgidefs.h.patch \ | 12 | file://0006-use-asm-sgidefs.h.patch \ |
14 | file://0007-Change-order-of-CFLAGS.patch \ | 13 | file://0007-Change-order-of-CFLAGS.patch \ |
diff --git a/meta/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch b/meta/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch deleted file mode 100644 index 37d633c9a8..0000000000 --- a/meta/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch +++ /dev/null | |||
@@ -1,914 +0,0 @@ | |||
1 | From d86ff49710210fb10d149121fa9a04c7cf41cb8b Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 2 Mar 2015 02:31:12 +0000 | ||
4 | Subject: [PATCH 04/10] Add support for Renesas SH (sh4) architecture. | ||
5 | |||
6 | gdb (7.4-1~cvs20111117.2) experimental; urgency=low | ||
7 | . | ||
8 | * Add Renesas SH (sh4) support (Closes: #576242) | ||
9 | - Thanks Nobuhiro Iwamatsu, Takashi Yoshii. | ||
10 | Author: Hector Oron <zumbi@debian.org> | ||
11 | Bug-Debian: http://bugs.debian.org/576242 | ||
12 | |||
13 | Upstream-Status: Pending | ||
14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
15 | --- | ||
16 | gdb/Makefile.in | 2 + | ||
17 | gdb/configure.host | 2 + | ||
18 | gdb/sh-linux-tdep.c | 519 +++++++++++++++++++++++++++ | ||
19 | gdb/sh-tdep.c | 52 +-- | ||
20 | gdb/sh-tdep.h | 49 +++ | ||
21 | gdb/testsuite/gdb.asm/asm-source.exp | 5 + | ||
22 | gdb/testsuite/gdb.asm/sh.inc | 3 +- | ||
23 | gdb/testsuite/gdb.base/annota1.c | 3 + | ||
24 | gdb/testsuite/gdb.base/annota3.c | 4 + | ||
25 | gdb/testsuite/gdb.base/sigall.c | 3 + | ||
26 | gdb/testsuite/gdb.base/signals.c | 4 + | ||
27 | 11 files changed, 618 insertions(+), 28 deletions(-) | ||
28 | |||
29 | diff --git a/gdb/Makefile.in b/gdb/Makefile.in | ||
30 | index b8729ed7b2e..ae5c05e1dbe 100644 | ||
31 | --- a/gdb/Makefile.in | ||
32 | +++ b/gdb/Makefile.in | ||
33 | @@ -2284,6 +2284,8 @@ ALLDEPFILES = \ | ||
34 | sh-netbsd-nat.c \ | ||
35 | sh-netbsd-tdep.c \ | ||
36 | sh-tdep.c \ | ||
37 | + sh-linux-tdep.c \ | ||
38 | + sh-linux-nat.c \ | ||
39 | sol2-tdep.c \ | ||
40 | solib-aix.c \ | ||
41 | solib-svr4.c \ | ||
42 | diff --git a/gdb/configure.host b/gdb/configure.host | ||
43 | index e94a19b0332..08b8478b56b 100644 | ||
44 | --- a/gdb/configure.host | ||
45 | +++ b/gdb/configure.host | ||
46 | @@ -151,6 +151,8 @@ riscv*-*-linux*) gdb_host=linux ;; | ||
47 | |||
48 | s390*-*-linux*) gdb_host=linux ;; | ||
49 | |||
50 | +sh*-*-linux*) gdb_host=linux ;; | ||
51 | + | ||
52 | sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu) | ||
53 | gdb_host=nbsd ;; | ||
54 | sh*-*-openbsd*) gdb_host=nbsd ;; | ||
55 | diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c | ||
56 | index 700df35bc3b..aaed47ded81 100644 | ||
57 | --- a/gdb/sh-linux-tdep.c | ||
58 | +++ b/gdb/sh-linux-tdep.c | ||
59 | @@ -18,14 +18,37 @@ | ||
60 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
61 | |||
62 | #include "defs.h" | ||
63 | +#include "gdbcore.h" | ||
64 | +#include "frame.h" | ||
65 | +#include "frame-base.h" | ||
66 | +#include "frame-unwind.h" | ||
67 | +#include "dwarf2-frame.h" | ||
68 | +#include "value.h" | ||
69 | +#include "regcache.h" | ||
70 | +#include "inferior.h" | ||
71 | #include "osabi.h" | ||
72 | |||
73 | +#include "reggroups.h" | ||
74 | +#include "arch-utils.h" | ||
75 | +#include "floatformat.h" | ||
76 | #include "solib-svr4.h" | ||
77 | #include "symtab.h" | ||
78 | +#include "gdb_string.h" | ||
79 | +#include "command.h" | ||
80 | +#include "gdb_assert.h" | ||
81 | |||
82 | #include "trad-frame.h" | ||
83 | #include "tramp-frame.h" | ||
84 | |||
85 | +#include <sys/ptrace.h> | ||
86 | +#include <sys/types.h> | ||
87 | +#include <sys/param.h> | ||
88 | +#include <sys/user.h> | ||
89 | +#include <sys/syscall.h> | ||
90 | + | ||
91 | +#include <asm/ptrace.h> | ||
92 | + | ||
93 | +#include "regset.h" | ||
94 | #include "glibc-tdep.h" | ||
95 | #include "sh-tdep.h" | ||
96 | #include "linux-tdep.h" | ||
97 | @@ -181,9 +204,505 @@ static struct tramp_frame sh_linux_rt_sigreturn_tramp_frame = { | ||
98 | sh_linux_rt_sigreturn_init | ||
99 | }; | ||
100 | |||
101 | +/* Recognizing signal handler frames. */ | ||
102 | + | ||
103 | +/* GNU/Linux has two flavors of signals. Normal signal handlers, and | ||
104 | + "realtime" (RT) signals. The RT signals can provide additional | ||
105 | + information to the signal handler if the SA_SIGINFO flag is set | ||
106 | + when establishing a signal handler using `sigaction'. It is not | ||
107 | + unlikely that future versions of GNU/Linux will support SA_SIGINFO | ||
108 | + for normal signals too. */ | ||
109 | + | ||
110 | +/* When the SH Linux kernel calls a signal handler and the | ||
111 | + SA_RESTORER flag isn't set, the return address points to a bit of | ||
112 | + code on the stack. This function returns whether the PC appears to | ||
113 | + be within this bit of code. | ||
114 | + | ||
115 | + The instruction sequence for normal signals is | ||
116 | + mov.w 1f,r3 | ||
117 | + trapa #16 | ||
118 | + or r0, r0 | ||
119 | + or r0, r0 | ||
120 | + or r0, r0 | ||
121 | + or r0, r0 | ||
122 | + or r0, r0 | ||
123 | + 1: .word __NR_sigreturn | ||
124 | + or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x0077. | ||
125 | + | ||
126 | + Checking for the code sequence should be somewhat reliable, because | ||
127 | + the effect is to call the system call sigreturn. This is unlikely | ||
128 | + to occur anywhere other than a signal trampoline. | ||
129 | + | ||
130 | + It kind of sucks that we have to read memory from the process in | ||
131 | + order to identify a signal trampoline, but there doesn't seem to be | ||
132 | + any other way. The PC_IN_SIGTRAMP macro in tm-linux.h arranges to | ||
133 | + only call us if no function name could be identified, which should | ||
134 | + be the case since the code is on the stack. | ||
135 | + | ||
136 | + Detection of signal trampolines for handlers that set the | ||
137 | + SA_RESTORER flag is in general not possible. Unfortunately this is | ||
138 | + what the GNU C Library has been doing for quite some time now. | ||
139 | + However, as of version 2.1.2, the GNU C Library uses signal | ||
140 | + trampolines (named __restore and __restore_rt) that are identical | ||
141 | + to the ones used by the kernel. Therefore, these trampolines are | ||
142 | + supported too. */ | ||
143 | + | ||
144 | +#define MOVW(n) (0x9300|((n)-2)) /* Move mem word at PC+n to R3 */ | ||
145 | +#define TRAP16 0xc310 /* Syscall w/no args (NR in R3) */ | ||
146 | +#define OR_R0_R0 0x200b /* or r0,r0 (insert to avoid hardware bug) */ | ||
147 | + | ||
148 | +#define LINUX_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */ | ||
149 | +#define LINUX_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */ | ||
150 | +#define LINUX_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */ | ||
151 | + | ||
152 | +static const unsigned short linux_sigtramp_code[] = | ||
153 | +{ | ||
154 | + LINUX_SIGTRAMP_INSN0, | ||
155 | + LINUX_SIGTRAMP_INSN1, | ||
156 | + LINUX_SIGTRAMP_INSN2, | ||
157 | + LINUX_SIGTRAMP_INSN2, | ||
158 | + LINUX_SIGTRAMP_INSN2, | ||
159 | + LINUX_SIGTRAMP_INSN2, | ||
160 | + LINUX_SIGTRAMP_INSN2, | ||
161 | + __NR_sigreturn | ||
162 | +}; | ||
163 | + | ||
164 | +#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code) | ||
165 | + | ||
166 | +/* If PC is in a sigtramp routine, return the address of the start of | ||
167 | + the routine. Otherwise, return 0. */ | ||
168 | + | ||
169 | +static CORE_ADDR | ||
170 | +sh_linux_sigtramp_start (struct frame_info *next_frame) | ||
171 | +{ | ||
172 | + CORE_ADDR pc = get_frame_pc (next_frame); | ||
173 | + gdb_byte buf[LINUX_SIGTRAMP_LEN]; | ||
174 | + | ||
175 | + /* We only recognize a signal trampoline if PC is at the start of | ||
176 | + one of the three instructions. We optimize for finding the PC at | ||
177 | + the start, as will be the case when the trampoline is not the | ||
178 | + first frame on the stack. We assume that in the case where the | ||
179 | + PC is not at the start of the instruction sequence, there will be | ||
180 | + a few trailing readable bytes on the stack. */ | ||
181 | + | ||
182 | + if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN)) | ||
183 | + return 0; | ||
184 | + | ||
185 | + if (buf[0] != LINUX_SIGTRAMP_INSN0) | ||
186 | + { | ||
187 | + if (buf[0] != LINUX_SIGTRAMP_INSN1) | ||
188 | + return 0; | ||
189 | + | ||
190 | + pc -= 2; | ||
191 | + | ||
192 | + if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN)) | ||
193 | + return 0; | ||
194 | + } | ||
195 | + | ||
196 | + if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0) | ||
197 | + return 0; | ||
198 | + | ||
199 | + return pc; | ||
200 | +} | ||
201 | + | ||
202 | +/* This function does the same for RT signals. Here the instruction | ||
203 | + sequence is | ||
204 | + mov.w 1f,r3 | ||
205 | + trapa #16 | ||
206 | + or r0, r0 | ||
207 | + or r0, r0 | ||
208 | + or r0, r0 | ||
209 | + or r0, r0 | ||
210 | + or r0, r0 | ||
211 | + 1: .word __NR_rt_sigreturn | ||
212 | + or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x00ad. | ||
213 | + | ||
214 | + The effect is to call the system call rt_sigreturn. */ | ||
215 | + | ||
216 | +#define LINUX_RT_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */ | ||
217 | +#define LINUX_RT_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */ | ||
218 | +#define LINUX_RT_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */ | ||
219 | + | ||
220 | +static const unsigned short linux_rt_sigtramp_code[] = | ||
221 | +{ | ||
222 | + LINUX_RT_SIGTRAMP_INSN0, | ||
223 | + LINUX_RT_SIGTRAMP_INSN1, | ||
224 | + LINUX_RT_SIGTRAMP_INSN2, | ||
225 | + LINUX_RT_SIGTRAMP_INSN2, | ||
226 | + LINUX_RT_SIGTRAMP_INSN2, | ||
227 | + LINUX_RT_SIGTRAMP_INSN2, | ||
228 | + LINUX_RT_SIGTRAMP_INSN2, | ||
229 | + __NR_rt_sigreturn | ||
230 | +}; | ||
231 | + | ||
232 | +#define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code) | ||
233 | + | ||
234 | +/* If PC is in a RT sigtramp routine, return the address of the start | ||
235 | + of the routine. Otherwise, return 0. */ | ||
236 | + | ||
237 | +static CORE_ADDR | ||
238 | +sh_linux_rt_sigtramp_start (struct frame_info *next_frame) | ||
239 | +{ | ||
240 | + CORE_ADDR pc = get_frame_pc (next_frame); | ||
241 | + gdb_byte buf[LINUX_RT_SIGTRAMP_LEN]; | ||
242 | + | ||
243 | + /* We only recognize a signal trampoline if PC is at the start of | ||
244 | + one of the two instructions. We optimize for finding the PC at | ||
245 | + the start, as will be the case when the trampoline is not the | ||
246 | + first frame on the stack. We assume that in the case where the | ||
247 | + PC is not at the start of the instruction sequence, there will be | ||
248 | + a few trailing readable bytes on the stack. */ | ||
249 | + | ||
250 | + if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_RT_SIGTRAMP_LEN)) | ||
251 | + return 0; | ||
252 | + | ||
253 | + if (buf[0] != LINUX_RT_SIGTRAMP_INSN0) | ||
254 | + { | ||
255 | + if (buf[0] != LINUX_RT_SIGTRAMP_INSN1) | ||
256 | + return 0; | ||
257 | + | ||
258 | + pc -= 2; | ||
259 | + | ||
260 | + if (!safe_frame_unwind_memory (next_frame, pc, buf, | ||
261 | + LINUX_RT_SIGTRAMP_LEN)) | ||
262 | + return 0; | ||
263 | + } | ||
264 | + | ||
265 | + if (memcmp (buf, linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN) != 0) | ||
266 | + return 0; | ||
267 | + | ||
268 | + return pc; | ||
269 | +} | ||
270 | + | ||
271 | +/* Return whether PC is in a GNU/Linux sigtramp routine. */ | ||
272 | + | ||
273 | +static int | ||
274 | +sh_linux_sigtramp_p (struct frame_info *this_frame) | ||
275 | +{ | ||
276 | + CORE_ADDR pc = get_frame_pc (this_frame); | ||
277 | + char *name; | ||
278 | + | ||
279 | + find_pc_partial_function (pc, &name, NULL, NULL); | ||
280 | + | ||
281 | + /* If we have NAME, we can optimize the search. The trampolines are | ||
282 | + named __restore and __restore_rt. However, they aren't dynamically | ||
283 | + exported from the shared C library, so the trampoline may appear to | ||
284 | + be part of the preceding function. This should always be sigaction, | ||
285 | + __sigaction, or __libc_sigaction (all aliases to the same function). */ | ||
286 | + if (name == NULL || strstr (name, "sigaction") != NULL) | ||
287 | + return (sh_linux_sigtramp_start (this_frame) != 0 | ||
288 | + || sh_linux_rt_sigtramp_start (this_frame) != 0); | ||
289 | + | ||
290 | + return (strcmp ("__restore", name) == 0 | ||
291 | + || strcmp ("__restore_rt", name) == 0); | ||
292 | +} | ||
293 | + | ||
294 | +/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */ | ||
295 | +#define SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 12 | ||
296 | + | ||
297 | + | ||
298 | +/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp | ||
299 | + routine, return the address of the associated sigcontext structure. */ | ||
300 | + | ||
301 | +static CORE_ADDR | ||
302 | +sh_linux_sigcontext_addr (struct frame_info *this_frame) | ||
303 | +{ | ||
304 | + CORE_ADDR pc; | ||
305 | + CORE_ADDR sp; | ||
306 | + | ||
307 | + sp = get_frame_register_unsigned (this_frame, SP_REGNUM); | ||
308 | + | ||
309 | + pc = sh_linux_sigtramp_start (this_frame); | ||
310 | + if (pc) | ||
311 | + { | ||
312 | + return sp; | ||
313 | + } | ||
314 | + | ||
315 | + pc = sh_linux_rt_sigtramp_start (this_frame); | ||
316 | + if (pc) | ||
317 | + { | ||
318 | + CORE_ADDR ucontext_addr; | ||
319 | + | ||
320 | + /* The sigcontext structure is part of the user context. A | ||
321 | + pointer to the user context is passed as the third argument | ||
322 | + to the signal handler. */ | ||
323 | + ucontext_addr = get_frame_register_unsigned (this_frame, ARG0_REGNUM+2); | ||
324 | + return ucontext_addr + SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET; | ||
325 | + } | ||
326 | + | ||
327 | + error ("Couldn't recognize signal trampoline."); | ||
328 | + return 0; | ||
329 | +} | ||
330 | + | ||
331 | +/* Signal trampolines. */ | ||
332 | +extern struct sh_frame_cache *sh_alloc_frame_cache (void); | ||
333 | + | ||
334 | +static struct sh_frame_cache * | ||
335 | +sh_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
336 | +{ | ||
337 | + struct sh_frame_cache *cache; | ||
338 | + struct gdbarch_tdep *tdep = gdbarch_tdep (get_current_arch ()); | ||
339 | + CORE_ADDR sigcontext_addr; | ||
340 | + | ||
341 | + if (*this_cache) | ||
342 | + return *this_cache; | ||
343 | + | ||
344 | + cache = sh_alloc_frame_cache (); | ||
345 | + | ||
346 | + cache->base = get_frame_register_unsigned (this_frame, SP_REGNUM); | ||
347 | + sigcontext_addr = tdep->sigcontext_addr (this_frame); | ||
348 | + if (tdep->sc_reg_offset) | ||
349 | + { | ||
350 | + int i; | ||
351 | + | ||
352 | + gdb_assert (tdep->sc_num_regs <= SH_NUM_REGS); | ||
353 | + | ||
354 | + for (i = 0; i < tdep->sc_num_regs; i++) | ||
355 | + if (tdep->sc_reg_offset[i] != -1) | ||
356 | + cache->saved_regs[i] = sigcontext_addr + tdep->sc_reg_offset[i]; | ||
357 | + } | ||
358 | + | ||
359 | + *this_cache = cache; | ||
360 | + return cache; | ||
361 | +} | ||
362 | + | ||
363 | +static void | ||
364 | +sh_linux_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache, | ||
365 | + struct frame_id *this_id) | ||
366 | +{ | ||
367 | + struct sh_frame_cache *cache = | ||
368 | + sh_linux_sigtramp_frame_cache (this_frame, this_cache); | ||
369 | + | ||
370 | + (*this_id) = frame_id_build (cache->base + 64, cache->pc); | ||
371 | +} | ||
372 | + | ||
373 | +extern struct value * sh_frame_prev_register (); | ||
374 | +static struct value * | ||
375 | +sh_linux_sigtramp_frame_prev_register (struct frame_info *this_frame, | ||
376 | + void **this_cache, int regnum) | ||
377 | +{ | ||
378 | + sh_linux_sigtramp_frame_cache (this_frame, this_cache); | ||
379 | + | ||
380 | + return sh_frame_prev_register (this_frame, this_cache, regnum); | ||
381 | +} | ||
382 | + | ||
383 | +static int | ||
384 | +sh_linux_sigtramp_frame_sniffer (const struct frame_unwind *self, | ||
385 | + struct frame_info *this_frame, | ||
386 | + void **this_prologue_cache) | ||
387 | +{ | ||
388 | + struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame)); | ||
389 | + | ||
390 | + /* We shouldn't even bother if we don't have a sigcontext_addr | ||
391 | + handler. */ | ||
392 | + if (tdep->sigcontext_addr == NULL) | ||
393 | + return 0; | ||
394 | + | ||
395 | + if (tdep->sigtramp_p != NULL) | ||
396 | + { | ||
397 | + if (tdep->sigtramp_p (this_frame)) | ||
398 | + return 1; | ||
399 | + } | ||
400 | + | ||
401 | + return 0; | ||
402 | +} | ||
403 | + | ||
404 | +static const struct frame_unwind sh_linux_sigtramp_frame_unwind = | ||
405 | +{ | ||
406 | + SIGTRAMP_FRAME, | ||
407 | + sh_linux_sigtramp_frame_this_id, | ||
408 | + sh_linux_sigtramp_frame_prev_register, | ||
409 | + NULL, | ||
410 | + sh_linux_sigtramp_frame_sniffer | ||
411 | +}; | ||
412 | + | ||
413 | +/* Supply register REGNUM from the buffer specified by GREGS and LEN | ||
414 | + in the general-purpose register set REGSET to register cache | ||
415 | + REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ | ||
416 | + | ||
417 | +void | ||
418 | +sh_supply_gregset (const struct regset *regset, struct regcache *regcache, | ||
419 | + int regnum, const void *gregs, size_t len) | ||
420 | +{ | ||
421 | + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); | ||
422 | + const char *regs = gregs; | ||
423 | + int i; | ||
424 | + | ||
425 | + gdb_assert (len == tdep->sizeof_gregset); | ||
426 | + | ||
427 | + for (i = 0; i < tdep->gregset_num_regs; i++) | ||
428 | + { | ||
429 | + if ((regnum == i || regnum == -1) | ||
430 | + && tdep->gregset_reg_offset[i] != -1) | ||
431 | + regcache_raw_supply (regcache, i, regs + tdep->gregset_reg_offset[i]); | ||
432 | + } | ||
433 | +} | ||
434 | + | ||
435 | +/* Collect register REGNUM from the register cache REGCACHE and store | ||
436 | + it in the buffer specified by GREGS and LEN as described by the | ||
437 | + general-purpose register set REGSET. If REGNUM is -1, do this for | ||
438 | + all registers in REGSET. */ | ||
439 | + | ||
440 | +void | ||
441 | +sh_collect_gregset (const struct regset *regset, | ||
442 | + const struct regcache *regcache, | ||
443 | + int regnum, void *gregs, size_t len) | ||
444 | +{ | ||
445 | + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); | ||
446 | + char *regs = gregs; | ||
447 | + int i; | ||
448 | + | ||
449 | + gdb_assert (len == tdep->sizeof_gregset); | ||
450 | + | ||
451 | + for (i = 0; i < tdep->gregset_num_regs; i++) | ||
452 | + { | ||
453 | + if ((regnum == i || regnum == -1) | ||
454 | + && tdep->gregset_reg_offset[i] != -1) | ||
455 | + regcache_raw_collect (regcache, i, regs + tdep->gregset_reg_offset[i]); | ||
456 | + } | ||
457 | +} | ||
458 | + | ||
459 | +/* Supply register REGNUM from the buffer specified by FPREGS and LEN | ||
460 | + in the floating-point register set REGSET to register cache | ||
461 | + REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ | ||
462 | + | ||
463 | +static void | ||
464 | +sh_supply_fpregset (const struct regset *regset, struct regcache *regcache, | ||
465 | + int regnum, const void *fpregs, size_t len) | ||
466 | +{ | ||
467 | + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); | ||
468 | + const char *regs = fpregs; | ||
469 | + int i; | ||
470 | + | ||
471 | + gdb_assert (len == tdep->sizeof_fpregset); | ||
472 | + for (i = 0; i < 16; i++) | ||
473 | + { | ||
474 | + if (regnum == i+25 || regnum == -1) | ||
475 | + regcache_raw_supply (regcache, i+25, regs + i*4); | ||
476 | + } | ||
477 | + if (regnum == FPSCR_REGNUM || regnum == -1) | ||
478 | + regcache_raw_supply (regcache, FPSCR_REGNUM, regs + 32*4); | ||
479 | + if (regnum == FPUL_REGNUM || regnum == -1) | ||
480 | + regcache_raw_supply (regcache, FPUL_REGNUM, regs + 33*4); | ||
481 | +} | ||
482 | + | ||
483 | +/* Collect register REGNUM from the register cache REGCACHE and store | ||
484 | + it in the buffer specified by FPREGS and LEN as described by the | ||
485 | + floating-point register set REGSET. If REGNUM is -1, do this for | ||
486 | + all registers in REGSET. */ | ||
487 | + | ||
488 | +static void | ||
489 | +sh_collect_fpregset (const struct regset *regset, | ||
490 | + const struct regcache *regcache, | ||
491 | + int regnum, void *fpregs, size_t len) | ||
492 | +{ | ||
493 | + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); | ||
494 | + char *regs = fpregs; | ||
495 | + int i; | ||
496 | + | ||
497 | + gdb_assert (len == tdep->sizeof_fpregset); | ||
498 | + for (i = 0; i < 16; i++) | ||
499 | + { | ||
500 | + if (regnum == i+25 || regnum == -1) | ||
501 | + regcache_raw_collect (regcache, i+25, regs + i*4); | ||
502 | + } | ||
503 | + if (regnum == FPSCR_REGNUM || regnum == -1) | ||
504 | + regcache_raw_collect (regcache, FPSCR_REGNUM, regs + 32*4); | ||
505 | + if (regnum == FPUL_REGNUM || regnum == -1) | ||
506 | + regcache_raw_collect (regcache, FPUL_REGNUM, regs + 33*4); | ||
507 | +} | ||
508 | + | ||
509 | +/* Return the appropriate register set for the core section identified | ||
510 | + by SECT_NAME and SECT_SIZE. */ | ||
511 | + | ||
512 | +const struct regset * | ||
513 | +sh_linux_regset_from_core_section (struct gdbarch *gdbarch, | ||
514 | + const char *sect_name, size_t sect_size) | ||
515 | +{ | ||
516 | + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | ||
517 | + | ||
518 | + if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset) | ||
519 | + { | ||
520 | + if (tdep->gregset == NULL) | ||
521 | + tdep->gregset = regset_alloc (gdbarch, sh_supply_gregset, | ||
522 | + sh_collect_gregset); | ||
523 | + return tdep->gregset; | ||
524 | + } | ||
525 | + | ||
526 | + if ((strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset)) | ||
527 | + { | ||
528 | + if (tdep->fpregset == NULL) | ||
529 | + tdep->fpregset = regset_alloc (gdbarch, sh_supply_fpregset, | ||
530 | + sh_collect_fpregset); | ||
531 | + return tdep->fpregset; | ||
532 | + } | ||
533 | + | ||
534 | + return NULL; | ||
535 | +} | ||
536 | + | ||
537 | +/* The register sets used in GNU/Linux ELF core-dumps are identical to | ||
538 | + the register sets in `struct user' that are used for a.out | ||
539 | + core-dumps. These are also used by ptrace(2). The corresponding | ||
540 | + types are `elf_gregset_t' for the general-purpose registers (with | ||
541 | + `elf_greg_t' the type of a single GP register) and `elf_fpregset_t' | ||
542 | + for the floating-point registers. | ||
543 | + | ||
544 | + Those types used to be available under the names `gregset_t' and | ||
545 | + `fpregset_t' too, and GDB used those names in the past. But those | ||
546 | + names are now used for the register sets used in the `mcontext_t' | ||
547 | + type, which have a different size and layout. */ | ||
548 | + | ||
549 | +/* Mapping between the general-purpose registers in `struct user' | ||
550 | + format and GDB's register cache layout. */ | ||
551 | + | ||
552 | +/* From <sys/reg.h>. */ | ||
553 | +static int sh_linux_gregset_reg_offset[] = | ||
554 | +{ | ||
555 | + 0, 4, 8, 12, 16, 20, 24, 28, | ||
556 | + 32, 36, 40, 44, 48, 52, 56, 60, | ||
557 | + | ||
558 | + REG_PC*4, REG_PR*4, REG_GBR*4, -1, | ||
559 | + REG_MACH*4, REG_MACL*4, REG_SR*4, | ||
560 | +}; | ||
561 | + | ||
562 | +/* Mapping between the general-purpose registers in `struct | ||
563 | + sigcontext' format and GDB's register cache layout. */ | ||
564 | + | ||
565 | +/* From <asm/sigcontext.h>. */ | ||
566 | +static int sh_linux_sc_reg_offset[] = | ||
567 | +{ | ||
568 | + 4, 8, 12, 16, 20, 24, 28, 32, | ||
569 | + 36, 40, 44, 48, 52, 56, 60, 64, | ||
570 | + 68, 72, 80, -1, | ||
571 | + 84, 88, 76 | ||
572 | +}; | ||
573 | + | ||
574 | static void | ||
575 | sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||
576 | { | ||
577 | + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | ||
578 | + bfd abfd; | ||
579 | + | ||
580 | + tdep->gregset_reg_offset = sh_linux_gregset_reg_offset; | ||
581 | + tdep->gregset_num_regs = ARRAY_SIZE (sh_linux_gregset_reg_offset); | ||
582 | + tdep->sizeof_gregset = 23 * 4; | ||
583 | + | ||
584 | + tdep->jb_pc_offset = 32; /* From <bits/setjmp.h>. */ | ||
585 | + | ||
586 | + tdep->sigtramp_p = sh_linux_sigtramp_p; | ||
587 | + tdep->sigcontext_addr = sh_linux_sigcontext_addr; | ||
588 | + tdep->sc_reg_offset = sh_linux_sc_reg_offset; | ||
589 | + tdep->sc_num_regs = ARRAY_SIZE (sh_linux_sc_reg_offset); | ||
590 | + | ||
591 | + frame_unwind_append_unwinder(gdbarch, &sh_linux_sigtramp_frame_unwind); | ||
592 | + | ||
593 | + /* If we have a register mapping, enable the generic core file | ||
594 | + support, unless it has already been enabled. */ | ||
595 | + if (tdep->gregset_reg_offset | ||
596 | + && !gdbarch_regset_from_core_section_p (gdbarch)) | ||
597 | + set_gdbarch_regset_from_core_section (gdbarch, | ||
598 | + sh_linux_regset_from_core_section); | ||
599 | + | ||
600 | linux_init_abi (info, gdbarch, 0); | ||
601 | |||
602 | /* GNU/Linux uses SVR4-style shared libraries. */ | ||
603 | diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c | ||
604 | index bfb220adf79..6a077b235bf 100644 | ||
605 | --- a/gdb/sh-tdep.c | ||
606 | +++ b/gdb/sh-tdep.c | ||
607 | @@ -21,6 +21,9 @@ | ||
608 | sac@cygnus.com. */ | ||
609 | |||
610 | #include "defs.h" | ||
611 | +#include "arch-utils.h" | ||
612 | +#include "command.h" | ||
613 | +#include "dummy-frame.h" | ||
614 | #include "frame.h" | ||
615 | #include "frame-base.h" | ||
616 | #include "frame-unwind.h" | ||
617 | @@ -66,23 +69,6 @@ static const char *const sh_cc_enum[] = { | ||
618 | |||
619 | static const char *sh_active_calling_convention = sh_cc_gcc; | ||
620 | |||
621 | -#define SH_NUM_REGS 67 | ||
622 | - | ||
623 | -struct sh_frame_cache | ||
624 | -{ | ||
625 | - /* Base address. */ | ||
626 | - CORE_ADDR base; | ||
627 | - LONGEST sp_offset; | ||
628 | - CORE_ADDR pc; | ||
629 | - | ||
630 | - /* Flag showing that a frame has been created in the prologue code. */ | ||
631 | - int uses_fp; | ||
632 | - | ||
633 | - /* Saved registers. */ | ||
634 | - CORE_ADDR saved_regs[SH_NUM_REGS]; | ||
635 | - CORE_ADDR saved_sp; | ||
636 | -}; | ||
637 | - | ||
638 | static int | ||
639 | sh_is_renesas_calling_convention (struct type *func_type) | ||
640 | { | ||
641 | @@ -1050,6 +1036,7 @@ sh_treat_as_flt_p (struct type *type) | ||
642 | return 0; | ||
643 | /* Otherwise if the type of that member is float, the whole type is | ||
644 | treated as float. */ | ||
645 | + type = check_typedef (type); | ||
646 | if (type->field (0).type ()->code () == TYPE_CODE_FLT) | ||
647 | return 1; | ||
648 | /* Otherwise it's not treated as float. */ | ||
649 | @@ -1100,7 +1087,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch, | ||
650 | in four registers available. Loop thru args from first to last. */ | ||
651 | for (argnum = 0; argnum < nargs; argnum++) | ||
652 | { | ||
653 | - type = value_type (args[argnum]); | ||
654 | + type = check_typedef (value_type (args[argnum])); | ||
655 | len = TYPE_LENGTH (type); | ||
656 | val = sh_justify_value_in_reg (gdbarch, args[argnum], len); | ||
657 | |||
658 | @@ -1835,7 +1822,7 @@ sh_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, | ||
659 | reg->how = DWARF2_FRAME_REG_UNDEFINED; | ||
660 | } | ||
661 | |||
662 | -static struct sh_frame_cache * | ||
663 | +struct sh_frame_cache * | ||
664 | sh_alloc_frame_cache (void) | ||
665 | { | ||
666 | struct sh_frame_cache *cache; | ||
667 | @@ -1862,7 +1849,7 @@ sh_alloc_frame_cache (void) | ||
668 | return cache; | ||
669 | } | ||
670 | |||
671 | -static struct sh_frame_cache * | ||
672 | +struct sh_frame_cache * | ||
673 | sh_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
674 | { | ||
675 | struct gdbarch *gdbarch = get_frame_arch (this_frame); | ||
676 | @@ -1929,9 +1916,9 @@ sh_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
677 | return cache; | ||
678 | } | ||
679 | |||
680 | -static struct value * | ||
681 | -sh_frame_prev_register (struct frame_info *this_frame, | ||
682 | - void **this_cache, int regnum) | ||
683 | +struct value * | ||
684 | +sh_frame_prev_register (struct frame_info *this_frame, void **this_cache, | ||
685 | + int regnum) | ||
686 | { | ||
687 | struct gdbarch *gdbarch = get_frame_arch (this_frame); | ||
688 | struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache); | ||
689 | @@ -1945,7 +1932,7 @@ sh_frame_prev_register (struct frame_info *this_frame, | ||
690 | the current frame. Frob regnum so that we pull the value from | ||
691 | the correct place. */ | ||
692 | if (regnum == gdbarch_pc_regnum (gdbarch)) | ||
693 | - regnum = PR_REGNUM; | ||
694 | + regnum = PR_REGNUM; /* XXX: really? */ | ||
695 | |||
696 | if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1) | ||
697 | return frame_unwind_got_memory (this_frame, regnum, | ||
698 | @@ -2236,8 +2223,8 @@ sh_return_in_first_hidden_param_p (struct gdbarch *gdbarch, | ||
699 | static struct gdbarch * | ||
700 | sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
701 | { | ||
702 | - struct gdbarch *gdbarch; | ||
703 | struct gdbarch_tdep *tdep; | ||
704 | + struct gdbarch *gdbarch; | ||
705 | |||
706 | /* If there is already a candidate, use it. */ | ||
707 | arches = gdbarch_list_lookup_by_info (arches, &info); | ||
708 | @@ -2249,6 +2236,18 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
709 | tdep = XCNEW (struct gdbarch_tdep); | ||
710 | gdbarch = gdbarch_alloc (&info, tdep); | ||
711 | |||
712 | + /* General-purpose registers. */ | ||
713 | + tdep->gregset = NULL; | ||
714 | + tdep->gregset_reg_offset = NULL; | ||
715 | + tdep->gregset_num_regs = 23; | ||
716 | + tdep->sizeof_gregset = 0; | ||
717 | + | ||
718 | + /* Floating-point registers. */ | ||
719 | + tdep->fpregset = NULL; | ||
720 | + tdep->sizeof_fpregset = 34*4; | ||
721 | + | ||
722 | + tdep->jb_pc_offset = -1; | ||
723 | + | ||
724 | set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); | ||
725 | set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT); | ||
726 | set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); | ||
727 | @@ -2400,10 +2399,11 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
728 | break; | ||
729 | } | ||
730 | |||
731 | + dwarf2_append_unwinders (gdbarch); | ||
732 | + | ||
733 | /* Hook in ABI-specific overrides, if they have been registered. */ | ||
734 | gdbarch_init_osabi (info, gdbarch); | ||
735 | |||
736 | - dwarf2_append_unwinders (gdbarch); | ||
737 | frame_unwind_append_unwinder (gdbarch, &sh_stub_unwind); | ||
738 | frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind); | ||
739 | |||
740 | diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h | ||
741 | index 737b6dc6bdc..8d82e819b8c 100644 | ||
742 | --- a/gdb/sh-tdep.h | ||
743 | +++ b/gdb/sh-tdep.h | ||
744 | @@ -21,6 +21,12 @@ | ||
745 | |||
746 | /* Contributed by Steve Chamberlain sac@cygnus.com. */ | ||
747 | |||
748 | +struct frame_info; | ||
749 | +struct gdbarch; | ||
750 | +struct reggroup; | ||
751 | +struct regset; | ||
752 | +struct regcache; | ||
753 | + | ||
754 | /* Registers for all SH variants. Used also by sh3-rom.c. */ | ||
755 | enum | ||
756 | { | ||
757 | @@ -29,6 +35,7 @@ enum | ||
758 | ARG0_REGNUM = 4, | ||
759 | ARGLAST_REGNUM = 7, | ||
760 | FP_REGNUM = 14, | ||
761 | + SP_REGNUM = 15, | ||
762 | PC_REGNUM = 16, | ||
763 | PR_REGNUM = 17, | ||
764 | GBR_REGNUM = 18, | ||
765 | @@ -81,6 +88,24 @@ enum | ||
766 | FV0_REGNUM = 76, | ||
767 | FV_LAST_REGNUM = 79 | ||
768 | }; | ||
769 | +#define SH_NUM_REGS 67 | ||
770 | + | ||
771 | +struct sh_frame_cache | ||
772 | +{ | ||
773 | + /* Base address. */ | ||
774 | + CORE_ADDR base; | ||
775 | + LONGEST sp_offset; | ||
776 | + CORE_ADDR pc; | ||
777 | + | ||
778 | + /* Flag showing that a frame has been created in the prologue code. */ | ||
779 | + int uses_fp; | ||
780 | + | ||
781 | + /* Saved registers. */ | ||
782 | + CORE_ADDR saved_regs[SH_NUM_REGS]; | ||
783 | + CORE_ADDR saved_sp; | ||
784 | +}; | ||
785 | + | ||
786 | +extern struct sh_frame_cache *sh_frame_cache (struct frame_info *next_frame, void **this_cache); | ||
787 | |||
788 | /* This structure describes a register in a core-file. */ | ||
789 | struct sh_corefile_regmap | ||
790 | @@ -89,8 +114,32 @@ struct sh_corefile_regmap | ||
791 | unsigned int offset; | ||
792 | }; | ||
793 | |||
794 | +/* sh architecture specific information. */ | ||
795 | struct gdbarch_tdep | ||
796 | { | ||
797 | + /* General-purpose registers. */ | ||
798 | + struct regset *gregset; | ||
799 | + int *gregset_reg_offset; | ||
800 | + int gregset_num_regs; | ||
801 | + size_t sizeof_gregset; | ||
802 | + | ||
803 | + /* Floating-point registers. */ | ||
804 | + struct regset *fpregset; | ||
805 | + size_t sizeof_fpregset; | ||
806 | + | ||
807 | + /* Offset of saved PC in jmp_buf. */ | ||
808 | + int jb_pc_offset; | ||
809 | + | ||
810 | + /* Detect sigtramp. */ | ||
811 | + int (*sigtramp_p) (struct frame_info *); | ||
812 | + | ||
813 | + /* Get address of sigcontext for sigtramp. */ | ||
814 | + CORE_ADDR (*sigcontext_addr) (struct frame_info *); | ||
815 | + | ||
816 | + /* Offset of registers in `struct sigcontext'. */ | ||
817 | + int *sc_reg_offset; | ||
818 | + int sc_num_regs; | ||
819 | + | ||
820 | /* Non-NULL when debugging from a core file. Provides the offset | ||
821 | where each general-purpose register is stored inside the associated | ||
822 | core file section. */ | ||
823 | diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp | ||
824 | index dedcd92f2df..ae81b8becd3 100644 | ||
825 | --- a/gdb/testsuite/gdb.asm/asm-source.exp | ||
826 | +++ b/gdb/testsuite/gdb.asm/asm-source.exp | ||
827 | @@ -116,6 +116,11 @@ switch -glob -- [istarget] { | ||
828 | append link-flags " -m elf32ppc" | ||
829 | } | ||
830 | } | ||
831 | + "sh*-linux*" { | ||
832 | + set asm-arch sh-linux | ||
833 | + set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}" | ||
834 | + set debug-flags "-gdwarf-2" | ||
835 | + } | ||
836 | "sh*-*-*" { | ||
837 | set asm-arch sh | ||
838 | set debug-flags "-gdwarf-2" | ||
839 | diff --git a/gdb/testsuite/gdb.asm/sh.inc b/gdb/testsuite/gdb.asm/sh.inc | ||
840 | index a4a5fc545e4..89efed7795c 100644 | ||
841 | --- a/gdb/testsuite/gdb.asm/sh.inc | ||
842 | +++ b/gdb/testsuite/gdb.asm/sh.inc | ||
843 | @@ -40,9 +40,8 @@ | ||
844 | mov.l .Lconst\@,r1 | ||
845 | bra .Lafterconst\@ | ||
846 | nop | ||
847 | - nop | ||
848 | -.Lconst\@: | ||
849 | .align 2 | ||
850 | +.Lconst\@: | ||
851 | .long \subr | ||
852 | .align 1 | ||
853 | .Lafterconst\@: | ||
854 | diff --git a/gdb/testsuite/gdb.base/annota1.c b/gdb/testsuite/gdb.base/annota1.c | ||
855 | index 424e1b83278..0de2e7b633a 100644 | ||
856 | --- a/gdb/testsuite/gdb.base/annota1.c | ||
857 | +++ b/gdb/testsuite/gdb.base/annota1.c | ||
858 | @@ -1,6 +1,9 @@ | ||
859 | #include <stdio.h> | ||
860 | #include <signal.h> | ||
861 | |||
862 | +#ifdef __sh__ | ||
863 | +#define signal(a,b) /* Signals not supported on this target - make them go away */ | ||
864 | +#endif | ||
865 | |||
866 | void | ||
867 | handle_USR1 (int sig) | ||
868 | diff --git a/gdb/testsuite/gdb.base/annota3.c b/gdb/testsuite/gdb.base/annota3.c | ||
869 | index 424e1b83278..952aaf218ab 100644 | ||
870 | --- a/gdb/testsuite/gdb.base/annota3.c | ||
871 | +++ b/gdb/testsuite/gdb.base/annota3.c | ||
872 | @@ -1,6 +1,10 @@ | ||
873 | #include <stdio.h> | ||
874 | #include <signal.h> | ||
875 | |||
876 | +#ifdef __sh__ | ||
877 | +#define signal(a,b) /* Signals not supported on this target - make them go away */ | ||
878 | +#endif | ||
879 | + | ||
880 | |||
881 | void | ||
882 | handle_USR1 (int sig) | ||
883 | diff --git a/gdb/testsuite/gdb.base/sigall.c b/gdb/testsuite/gdb.base/sigall.c | ||
884 | index 81f3b08d6bc..1574b2d6cb8 100644 | ||
885 | --- a/gdb/testsuite/gdb.base/sigall.c | ||
886 | +++ b/gdb/testsuite/gdb.base/sigall.c | ||
887 | @@ -1,6 +1,9 @@ | ||
888 | #include <signal.h> | ||
889 | #include <unistd.h> | ||
890 | |||
891 | +#ifdef __sh__ | ||
892 | +#define signal(a,b) /* Signals not supported on this target - make them go away */ | ||
893 | +#endif | ||
894 | |||
895 | /* Signal handlers, we set breakpoints in them to make sure that the | ||
896 | signals really get delivered. */ | ||
897 | diff --git a/gdb/testsuite/gdb.base/signals.c b/gdb/testsuite/gdb.base/signals.c | ||
898 | index 756606880fa..1205a9bc9c5 100644 | ||
899 | --- a/gdb/testsuite/gdb.base/signals.c | ||
900 | +++ b/gdb/testsuite/gdb.base/signals.c | ||
901 | @@ -3,6 +3,10 @@ | ||
902 | #include <signal.h> | ||
903 | #include <unistd.h> | ||
904 | |||
905 | +#ifdef __sh__ | ||
906 | +#define signal(a,b) /* Signals not supported on this target - make them go away */ | ||
907 | +#define alarm(a) /* Ditto for alarm() */ | ||
908 | +#endif | ||
909 | |||
910 | static int count = 0; | ||
911 | |||
912 | -- | ||
913 | 2.33.1 | ||
914 | |||