diff options
author | Khem Raj <raj.khem@gmail.com> | 2012-04-25 15:45:32 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-01 12:38:08 +0100 |
commit | cde6bce4b7dd04afbc51aa9295a6757d2b8ee0ba (patch) | |
tree | 3cad0ccb7815ba433832fbef31a1f3d96f3a1de7 /meta/recipes-devtools/gdb | |
parent | cc18e7c0b93eaa77dca8285b211db807fec603fb (diff) | |
download | poky-cde6bce4b7dd04afbc51aa9295a6757d2b8ee0ba.tar.gz |
gdb: Add support for building gdb target for SH4
(From OE-Core rev: d478424fbe01942577ab541174df191528556554)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gdb')
-rw-r--r-- | meta/recipes-devtools/gdb/gdb-common.inc | 2 | ||||
-rw-r--r-- | meta/recipes-devtools/gdb/gdb.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch | 1389 |
3 files changed, 1391 insertions, 1 deletions
diff --git a/meta/recipes-devtools/gdb/gdb-common.inc b/meta/recipes-devtools/gdb/gdb-common.inc index b520353721..8836aa3091 100644 --- a/meta/recipes-devtools/gdb/gdb-common.inc +++ b/meta/recipes-devtools/gdb/gdb-common.inc | |||
@@ -12,7 +12,7 @@ LTTNGUST_mips64 = "" | |||
12 | LTTNGUST_mips64el = "" | 12 | LTTNGUST_mips64el = "" |
13 | LTTNGUST_sh4 = "" | 13 | LTTNGUST_sh4 = "" |
14 | 14 | ||
15 | INC_PR = "r8" | 15 | INC_PR = "r9" |
16 | 16 | ||
17 | LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ | 17 | LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ |
18 | file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674 \ | 18 | file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674 \ |
diff --git a/meta/recipes-devtools/gdb/gdb.inc b/meta/recipes-devtools/gdb/gdb.inc index 9f5f34fed9..a620eca501 100644 --- a/meta/recipes-devtools/gdb/gdb.inc +++ b/meta/recipes-devtools/gdb/gdb.inc | |||
@@ -4,6 +4,7 @@ inherit gettext | |||
4 | 4 | ||
5 | SRC_URI += "file://kill_arm_map_symbols.patch \ | 5 | SRC_URI += "file://kill_arm_map_symbols.patch \ |
6 | file://gdbserver-cflags-last.diff;striplevel=0 \ | 6 | file://gdbserver-cflags-last.diff;striplevel=0 \ |
7 | file://renesas-sh-native-support.patch \ | ||
7 | " | 8 | " |
8 | #LDFLAGS_append = " -s" | 9 | #LDFLAGS_append = " -s" |
9 | #export CFLAGS_append=" -L${STAGING_LIBDIR}" | 10 | #export CFLAGS_append=" -L${STAGING_LIBDIR}" |
diff --git a/meta/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch b/meta/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch new file mode 100644 index 0000000000..2b1ceb79f2 --- /dev/null +++ b/meta/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch | |||
@@ -0,0 +1,1389 @@ | |||
1 | Description: Add Renesas SH (sh4) support | ||
2 | Add support for Renesas SH (sh4) architecture. | ||
3 | . | ||
4 | gdb (7.4-1~cvs20111117.2) experimental; urgency=low | ||
5 | . | ||
6 | * Add Renesas SH (sh4) support (Closes: #576242) | ||
7 | - Thanks Nobuhiro Iwamatsu, Takashi Yoshii. | ||
8 | Author: Hector Oron <zumbi@debian.org> | ||
9 | Bug-Debian: http://bugs.debian.org/576242 | ||
10 | |||
11 | --- | ||
12 | The information above should follow the Patch Tagging Guidelines, please | ||
13 | checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here | ||
14 | are templates for supplementary fields that you might want to add: | ||
15 | |||
16 | Forwarded: <no|not-needed|url proving that it has been forwarded> | ||
17 | Last-Update: <2011-11-17> | ||
18 | |||
19 | |||
20 | Upstream-Status: Pending | ||
21 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
22 | |||
23 | Index: gdb-7.4/gdb/configure.host | ||
24 | =================================================================== | ||
25 | --- gdb-7.4.orig/gdb/configure.host 2012-04-24 07:06:35.085317177 -0700 | ||
26 | +++ gdb-7.4/gdb/configure.host 2012-04-24 07:09:14.365324889 -0700 | ||
27 | @@ -139,6 +139,7 @@ | ||
28 | |||
29 | s390*-*-*) gdb_host=s390 ;; | ||
30 | |||
31 | +sh*-*-linux*) gdb_host=linux ;; | ||
32 | sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu) | ||
33 | gdb_host=nbsd ;; | ||
34 | sh*-*-openbsd*) gdb_host=nbsd ;; | ||
35 | Index: gdb-7.4/gdb/Makefile.in | ||
36 | =================================================================== | ||
37 | --- gdb-7.4.orig/gdb/Makefile.in 2012-04-24 07:06:35.093317178 -0700 | ||
38 | +++ gdb-7.4/gdb/Makefile.in 2012-04-24 07:09:14.369324886 -0700 | ||
39 | @@ -1544,6 +1544,7 @@ | ||
40 | score-tdep.c \ | ||
41 | ser-go32.c ser-pipe.c ser-tcp.c ser-mingw.c \ | ||
42 | sh-tdep.c sh64-tdep.c shnbsd-tdep.c shnbsd-nat.c \ | ||
43 | + sh-linux-tdep.c sh-linux-nat.c \ | ||
44 | sol2-tdep.c \ | ||
45 | solib-irix.c solib-svr4.c solib-sunos.c \ | ||
46 | sparc-linux-nat.c sparc-linux-tdep.c \ | ||
47 | Index: gdb-7.4/gdb/sh-linux-tdep.c | ||
48 | =================================================================== | ||
49 | --- gdb-7.4.orig/gdb/sh-linux-tdep.c 2012-04-24 07:06:35.073317177 -0700 | ||
50 | +++ gdb-7.4/gdb/sh-linux-tdep.c 2012-04-24 07:09:14.369324886 -0700 | ||
51 | @@ -18,11 +18,34 @@ | ||
52 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
53 | |||
54 | #include "defs.h" | ||
55 | +#include "gdbcore.h" | ||
56 | +#include "frame.h" | ||
57 | +#include "frame-base.h" | ||
58 | +#include "frame-unwind.h" | ||
59 | +#include "dwarf2-frame.h" | ||
60 | +#include "value.h" | ||
61 | +#include "regcache.h" | ||
62 | +#include "inferior.h" | ||
63 | #include "osabi.h" | ||
64 | |||
65 | +#include "reggroups.h" | ||
66 | +#include "arch-utils.h" | ||
67 | +#include "floatformat.h" | ||
68 | #include "solib-svr4.h" | ||
69 | #include "symtab.h" | ||
70 | +#include "gdb_string.h" | ||
71 | +#include "command.h" | ||
72 | +#include "gdb_assert.h" | ||
73 | |||
74 | +#include <sys/ptrace.h> | ||
75 | +#include <sys/types.h> | ||
76 | +#include <sys/param.h> | ||
77 | +#include <sys/user.h> | ||
78 | +#include <sys/syscall.h> | ||
79 | + | ||
80 | +#include <asm/ptrace.h> | ||
81 | + | ||
82 | +#include "regset.h" | ||
83 | #include "glibc-tdep.h" | ||
84 | #include "sh-tdep.h" | ||
85 | #include "linux-tdep.h" | ||
86 | @@ -70,9 +93,505 @@ | ||
87 | {-1 /* Terminator. */, 0} | ||
88 | }; | ||
89 | |||
90 | +/* Recognizing signal handler frames. */ | ||
91 | + | ||
92 | +/* GNU/Linux has two flavors of signals. Normal signal handlers, and | ||
93 | + "realtime" (RT) signals. The RT signals can provide additional | ||
94 | + information to the signal handler if the SA_SIGINFO flag is set | ||
95 | + when establishing a signal handler using `sigaction'. It is not | ||
96 | + unlikely that future versions of GNU/Linux will support SA_SIGINFO | ||
97 | + for normal signals too. */ | ||
98 | + | ||
99 | +/* When the SH Linux kernel calls a signal handler and the | ||
100 | + SA_RESTORER flag isn't set, the return address points to a bit of | ||
101 | + code on the stack. This function returns whether the PC appears to | ||
102 | + be within this bit of code. | ||
103 | + | ||
104 | + The instruction sequence for normal signals is | ||
105 | + mov.w 1f,r3 | ||
106 | + trapa #16 | ||
107 | + or r0, r0 | ||
108 | + or r0, r0 | ||
109 | + or r0, r0 | ||
110 | + or r0, r0 | ||
111 | + or r0, r0 | ||
112 | + 1: .word __NR_sigreturn | ||
113 | + or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x0077. | ||
114 | + | ||
115 | + Checking for the code sequence should be somewhat reliable, because | ||
116 | + the effect is to call the system call sigreturn. This is unlikely | ||
117 | + to occur anywhere other than a signal trampoline. | ||
118 | + | ||
119 | + It kind of sucks that we have to read memory from the process in | ||
120 | + order to identify a signal trampoline, but there doesn't seem to be | ||
121 | + any other way. The PC_IN_SIGTRAMP macro in tm-linux.h arranges to | ||
122 | + only call us if no function name could be identified, which should | ||
123 | + be the case since the code is on the stack. | ||
124 | + | ||
125 | + Detection of signal trampolines for handlers that set the | ||
126 | + SA_RESTORER flag is in general not possible. Unfortunately this is | ||
127 | + what the GNU C Library has been doing for quite some time now. | ||
128 | + However, as of version 2.1.2, the GNU C Library uses signal | ||
129 | + trampolines (named __restore and __restore_rt) that are identical | ||
130 | + to the ones used by the kernel. Therefore, these trampolines are | ||
131 | + supported too. */ | ||
132 | + | ||
133 | +#define MOVW(n) (0x9300|((n)-2)) /* Move mem word at PC+n to R3 */ | ||
134 | +#define TRAP16 0xc310 /* Syscall w/no args (NR in R3) */ | ||
135 | +#define OR_R0_R0 0x200b /* or r0,r0 (insert to avoid hardware bug) */ | ||
136 | + | ||
137 | +#define LINUX_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */ | ||
138 | +#define LINUX_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */ | ||
139 | +#define LINUX_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */ | ||
140 | + | ||
141 | +static const unsigned short linux_sigtramp_code[] = | ||
142 | +{ | ||
143 | + LINUX_SIGTRAMP_INSN0, | ||
144 | + LINUX_SIGTRAMP_INSN1, | ||
145 | + LINUX_SIGTRAMP_INSN2, | ||
146 | + LINUX_SIGTRAMP_INSN2, | ||
147 | + LINUX_SIGTRAMP_INSN2, | ||
148 | + LINUX_SIGTRAMP_INSN2, | ||
149 | + LINUX_SIGTRAMP_INSN2, | ||
150 | + __NR_sigreturn | ||
151 | +}; | ||
152 | + | ||
153 | +#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code) | ||
154 | + | ||
155 | +/* If PC is in a sigtramp routine, return the address of the start of | ||
156 | + the routine. Otherwise, return 0. */ | ||
157 | + | ||
158 | +static CORE_ADDR | ||
159 | +sh_linux_sigtramp_start (struct frame_info *next_frame) | ||
160 | +{ | ||
161 | + CORE_ADDR pc = get_frame_pc (next_frame); | ||
162 | + gdb_byte buf[LINUX_SIGTRAMP_LEN]; | ||
163 | + | ||
164 | + /* We only recognize a signal trampoline if PC is at the start of | ||
165 | + one of the three instructions. We optimize for finding the PC at | ||
166 | + the start, as will be the case when the trampoline is not the | ||
167 | + first frame on the stack. We assume that in the case where the | ||
168 | + PC is not at the start of the instruction sequence, there will be | ||
169 | + a few trailing readable bytes on the stack. */ | ||
170 | + | ||
171 | + if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN)) | ||
172 | + return 0; | ||
173 | + | ||
174 | + if (buf[0] != LINUX_SIGTRAMP_INSN0) | ||
175 | + { | ||
176 | + if (buf[0] != LINUX_SIGTRAMP_INSN1) | ||
177 | + return 0; | ||
178 | + | ||
179 | + pc -= 2; | ||
180 | + | ||
181 | + if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN)) | ||
182 | + return 0; | ||
183 | + } | ||
184 | + | ||
185 | + if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0) | ||
186 | + return 0; | ||
187 | + | ||
188 | + return pc; | ||
189 | +} | ||
190 | + | ||
191 | +/* This function does the same for RT signals. Here the instruction | ||
192 | + sequence is | ||
193 | + mov.w 1f,r3 | ||
194 | + trapa #16 | ||
195 | + or r0, r0 | ||
196 | + or r0, r0 | ||
197 | + or r0, r0 | ||
198 | + or r0, r0 | ||
199 | + or r0, r0 | ||
200 | + 1: .word __NR_rt_sigreturn | ||
201 | + or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x00ad. | ||
202 | + | ||
203 | + The effect is to call the system call rt_sigreturn. */ | ||
204 | + | ||
205 | +#define LINUX_RT_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */ | ||
206 | +#define LINUX_RT_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */ | ||
207 | +#define LINUX_RT_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */ | ||
208 | + | ||
209 | +static const unsigned short linux_rt_sigtramp_code[] = | ||
210 | +{ | ||
211 | + LINUX_RT_SIGTRAMP_INSN0, | ||
212 | + LINUX_RT_SIGTRAMP_INSN1, | ||
213 | + LINUX_RT_SIGTRAMP_INSN2, | ||
214 | + LINUX_RT_SIGTRAMP_INSN2, | ||
215 | + LINUX_RT_SIGTRAMP_INSN2, | ||
216 | + LINUX_RT_SIGTRAMP_INSN2, | ||
217 | + LINUX_RT_SIGTRAMP_INSN2, | ||
218 | + __NR_rt_sigreturn | ||
219 | +}; | ||
220 | + | ||
221 | +#define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code) | ||
222 | + | ||
223 | +/* If PC is in a RT sigtramp routine, return the address of the start | ||
224 | + of the routine. Otherwise, return 0. */ | ||
225 | + | ||
226 | +static CORE_ADDR | ||
227 | +sh_linux_rt_sigtramp_start (struct frame_info *next_frame) | ||
228 | +{ | ||
229 | + CORE_ADDR pc = get_frame_pc (next_frame); | ||
230 | + gdb_byte buf[LINUX_RT_SIGTRAMP_LEN]; | ||
231 | + | ||
232 | + /* We only recognize a signal trampoline if PC is at the start of | ||
233 | + one of the two instructions. We optimize for finding the PC at | ||
234 | + the start, as will be the case when the trampoline is not the | ||
235 | + first frame on the stack. We assume that in the case where the | ||
236 | + PC is not at the start of the instruction sequence, there will be | ||
237 | + a few trailing readable bytes on the stack. */ | ||
238 | + | ||
239 | + if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_RT_SIGTRAMP_LEN)) | ||
240 | + return 0; | ||
241 | + | ||
242 | + if (buf[0] != LINUX_RT_SIGTRAMP_INSN0) | ||
243 | + { | ||
244 | + if (buf[0] != LINUX_RT_SIGTRAMP_INSN1) | ||
245 | + return 0; | ||
246 | + | ||
247 | + pc -= 2; | ||
248 | + | ||
249 | + if (!safe_frame_unwind_memory (next_frame, pc, buf, | ||
250 | + LINUX_RT_SIGTRAMP_LEN)) | ||
251 | + return 0; | ||
252 | + } | ||
253 | + | ||
254 | + if (memcmp (buf, linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN) != 0) | ||
255 | + return 0; | ||
256 | + | ||
257 | + return pc; | ||
258 | +} | ||
259 | + | ||
260 | +/* Return whether PC is in a GNU/Linux sigtramp routine. */ | ||
261 | + | ||
262 | +static int | ||
263 | +sh_linux_sigtramp_p (struct frame_info *this_frame) | ||
264 | +{ | ||
265 | + CORE_ADDR pc = get_frame_pc (this_frame); | ||
266 | + char *name; | ||
267 | + | ||
268 | + find_pc_partial_function (pc, &name, NULL, NULL); | ||
269 | + | ||
270 | + /* If we have NAME, we can optimize the search. The trampolines are | ||
271 | + named __restore and __restore_rt. However, they aren't dynamically | ||
272 | + exported from the shared C library, so the trampoline may appear to | ||
273 | + be part of the preceding function. This should always be sigaction, | ||
274 | + __sigaction, or __libc_sigaction (all aliases to the same function). */ | ||
275 | + if (name == NULL || strstr (name, "sigaction") != NULL) | ||
276 | + return (sh_linux_sigtramp_start (this_frame) != 0 | ||
277 | + || sh_linux_rt_sigtramp_start (this_frame) != 0); | ||
278 | + | ||
279 | + return (strcmp ("__restore", name) == 0 | ||
280 | + || strcmp ("__restore_rt", name) == 0); | ||
281 | +} | ||
282 | + | ||
283 | +/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */ | ||
284 | +#define SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 12 | ||
285 | + | ||
286 | + | ||
287 | +/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp | ||
288 | + routine, return the address of the associated sigcontext structure. */ | ||
289 | + | ||
290 | +static CORE_ADDR | ||
291 | +sh_linux_sigcontext_addr (struct frame_info *this_frame) | ||
292 | +{ | ||
293 | + CORE_ADDR pc; | ||
294 | + CORE_ADDR sp; | ||
295 | + | ||
296 | + sp = get_frame_register_unsigned (this_frame, SP_REGNUM); | ||
297 | + | ||
298 | + pc = sh_linux_sigtramp_start (this_frame); | ||
299 | + if (pc) | ||
300 | + { | ||
301 | + return sp; | ||
302 | + } | ||
303 | + | ||
304 | + pc = sh_linux_rt_sigtramp_start (this_frame); | ||
305 | + if (pc) | ||
306 | + { | ||
307 | + CORE_ADDR ucontext_addr; | ||
308 | + | ||
309 | + /* The sigcontext structure is part of the user context. A | ||
310 | + pointer to the user context is passed as the third argument | ||
311 | + to the signal handler. */ | ||
312 | + ucontext_addr = get_frame_register_unsigned (this_frame, ARG0_REGNUM+2); | ||
313 | + return ucontext_addr + SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET; | ||
314 | + } | ||
315 | + | ||
316 | + error ("Couldn't recognize signal trampoline."); | ||
317 | + return 0; | ||
318 | +} | ||
319 | + | ||
320 | +/* Signal trampolines. */ | ||
321 | +extern struct sh_frame_cache *sh_alloc_frame_cache (void); | ||
322 | + | ||
323 | +static struct sh_frame_cache * | ||
324 | +sh_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
325 | +{ | ||
326 | + struct sh_frame_cache *cache; | ||
327 | + struct gdbarch_tdep *tdep = gdbarch_tdep (get_current_arch ()); | ||
328 | + CORE_ADDR sigcontext_addr; | ||
329 | + | ||
330 | + if (*this_cache) | ||
331 | + return *this_cache; | ||
332 | + | ||
333 | + cache = sh_alloc_frame_cache (); | ||
334 | + | ||
335 | + cache->base = get_frame_register_unsigned (this_frame, SP_REGNUM); | ||
336 | + sigcontext_addr = tdep->sigcontext_addr (this_frame); | ||
337 | + if (tdep->sc_reg_offset) | ||
338 | + { | ||
339 | + int i; | ||
340 | + | ||
341 | + gdb_assert (tdep->sc_num_regs <= SH_NUM_REGS); | ||
342 | + | ||
343 | + for (i = 0; i < tdep->sc_num_regs; i++) | ||
344 | + if (tdep->sc_reg_offset[i] != -1) | ||
345 | + cache->saved_regs[i] = sigcontext_addr + tdep->sc_reg_offset[i]; | ||
346 | + } | ||
347 | + | ||
348 | + *this_cache = cache; | ||
349 | + return cache; | ||
350 | +} | ||
351 | + | ||
352 | +static void | ||
353 | +sh_linux_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache, | ||
354 | + struct frame_id *this_id) | ||
355 | +{ | ||
356 | + struct sh_frame_cache *cache = | ||
357 | + sh_linux_sigtramp_frame_cache (this_frame, this_cache); | ||
358 | + | ||
359 | + (*this_id) = frame_id_build (cache->base + 64, cache->pc); | ||
360 | +} | ||
361 | + | ||
362 | +extern struct value * sh_frame_prev_register (); | ||
363 | +static struct value * | ||
364 | +sh_linux_sigtramp_frame_prev_register (struct frame_info *this_frame, | ||
365 | + void **this_cache, int regnum) | ||
366 | +{ | ||
367 | + sh_linux_sigtramp_frame_cache (this_frame, this_cache); | ||
368 | + | ||
369 | + return sh_frame_prev_register (this_frame, this_cache, regnum); | ||
370 | +} | ||
371 | + | ||
372 | +static int | ||
373 | +sh_linux_sigtramp_frame_sniffer (const struct frame_unwind *self, | ||
374 | + struct frame_info *this_frame, | ||
375 | + void **this_prologue_cache) | ||
376 | +{ | ||
377 | + struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame)); | ||
378 | + | ||
379 | + /* We shouldn't even bother if we don't have a sigcontext_addr | ||
380 | + handler. */ | ||
381 | + if (tdep->sigcontext_addr == NULL) | ||
382 | + return 0; | ||
383 | + | ||
384 | + if (tdep->sigtramp_p != NULL) | ||
385 | + { | ||
386 | + if (tdep->sigtramp_p (this_frame)) | ||
387 | + return 1; | ||
388 | + } | ||
389 | + | ||
390 | + return 0; | ||
391 | +} | ||
392 | + | ||
393 | +static const struct frame_unwind sh_linux_sigtramp_frame_unwind = | ||
394 | +{ | ||
395 | + SIGTRAMP_FRAME, | ||
396 | + sh_linux_sigtramp_frame_this_id, | ||
397 | + sh_linux_sigtramp_frame_prev_register, | ||
398 | + NULL, | ||
399 | + sh_linux_sigtramp_frame_sniffer | ||
400 | +}; | ||
401 | + | ||
402 | +/* Supply register REGNUM from the buffer specified by GREGS and LEN | ||
403 | + in the general-purpose register set REGSET to register cache | ||
404 | + REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ | ||
405 | + | ||
406 | +void | ||
407 | +sh_supply_gregset (const struct regset *regset, struct regcache *regcache, | ||
408 | + int regnum, const void *gregs, size_t len) | ||
409 | +{ | ||
410 | + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); | ||
411 | + const char *regs = gregs; | ||
412 | + int i; | ||
413 | + | ||
414 | + gdb_assert (len == tdep->sizeof_gregset); | ||
415 | + | ||
416 | + for (i = 0; i < tdep->gregset_num_regs; i++) | ||
417 | + { | ||
418 | + if ((regnum == i || regnum == -1) | ||
419 | + && tdep->gregset_reg_offset[i] != -1) | ||
420 | + regcache_raw_supply (regcache, i, regs + tdep->gregset_reg_offset[i]); | ||
421 | + } | ||
422 | +} | ||
423 | + | ||
424 | +/* Collect register REGNUM from the register cache REGCACHE and store | ||
425 | + it in the buffer specified by GREGS and LEN as described by the | ||
426 | + general-purpose register set REGSET. If REGNUM is -1, do this for | ||
427 | + all registers in REGSET. */ | ||
428 | + | ||
429 | +void | ||
430 | +sh_collect_gregset (const struct regset *regset, | ||
431 | + const struct regcache *regcache, | ||
432 | + int regnum, void *gregs, size_t len) | ||
433 | +{ | ||
434 | + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); | ||
435 | + char *regs = gregs; | ||
436 | + int i; | ||
437 | + | ||
438 | + gdb_assert (len == tdep->sizeof_gregset); | ||
439 | + | ||
440 | + for (i = 0; i < tdep->gregset_num_regs; i++) | ||
441 | + { | ||
442 | + if ((regnum == i || regnum == -1) | ||
443 | + && tdep->gregset_reg_offset[i] != -1) | ||
444 | + regcache_raw_collect (regcache, i, regs + tdep->gregset_reg_offset[i]); | ||
445 | + } | ||
446 | +} | ||
447 | + | ||
448 | +/* Supply register REGNUM from the buffer specified by FPREGS and LEN | ||
449 | + in the floating-point register set REGSET to register cache | ||
450 | + REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ | ||
451 | + | ||
452 | +static void | ||
453 | +sh_supply_fpregset (const struct regset *regset, struct regcache *regcache, | ||
454 | + int regnum, const void *fpregs, size_t len) | ||
455 | +{ | ||
456 | + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); | ||
457 | + const char *regs = fpregs; | ||
458 | + int i; | ||
459 | + | ||
460 | + gdb_assert (len == tdep->sizeof_fpregset); | ||
461 | + for (i = 0; i < 16; i++) | ||
462 | + { | ||
463 | + if (regnum == i+25 || regnum == -1) | ||
464 | + regcache_raw_supply (regcache, i+25, regs + i*4); | ||
465 | + } | ||
466 | + if (regnum == FPSCR_REGNUM || regnum == -1) | ||
467 | + regcache_raw_supply (regcache, FPSCR_REGNUM, regs + 32*4); | ||
468 | + if (regnum == FPUL_REGNUM || regnum == -1) | ||
469 | + regcache_raw_supply (regcache, FPUL_REGNUM, regs + 33*4); | ||
470 | +} | ||
471 | + | ||
472 | +/* Collect register REGNUM from the register cache REGCACHE and store | ||
473 | + it in the buffer specified by FPREGS and LEN as described by the | ||
474 | + floating-point register set REGSET. If REGNUM is -1, do this for | ||
475 | + all registers in REGSET. */ | ||
476 | + | ||
477 | +static void | ||
478 | +sh_collect_fpregset (const struct regset *regset, | ||
479 | + const struct regcache *regcache, | ||
480 | + int regnum, void *fpregs, size_t len) | ||
481 | +{ | ||
482 | + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); | ||
483 | + char *regs = fpregs; | ||
484 | + int i; | ||
485 | + | ||
486 | + gdb_assert (len == tdep->sizeof_fpregset); | ||
487 | + for (i = 0; i < 16; i++) | ||
488 | + { | ||
489 | + if (regnum == i+25 || regnum == -1) | ||
490 | + regcache_raw_collect (regcache, i+25, regs + i*4); | ||
491 | + } | ||
492 | + if (regnum == FPSCR_REGNUM || regnum == -1) | ||
493 | + regcache_raw_collect (regcache, FPSCR_REGNUM, regs + 32*4); | ||
494 | + if (regnum == FPUL_REGNUM || regnum == -1) | ||
495 | + regcache_raw_collect (regcache, FPUL_REGNUM, regs + 33*4); | ||
496 | +} | ||
497 | + | ||
498 | +/* Return the appropriate register set for the core section identified | ||
499 | + by SECT_NAME and SECT_SIZE. */ | ||
500 | + | ||
501 | +const struct regset * | ||
502 | +sh_linux_regset_from_core_section (struct gdbarch *gdbarch, | ||
503 | + const char *sect_name, size_t sect_size) | ||
504 | +{ | ||
505 | + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | ||
506 | + | ||
507 | + if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset) | ||
508 | + { | ||
509 | + if (tdep->gregset == NULL) | ||
510 | + tdep->gregset = regset_alloc (gdbarch, sh_supply_gregset, | ||
511 | + sh_collect_gregset); | ||
512 | + return tdep->gregset; | ||
513 | + } | ||
514 | + | ||
515 | + if ((strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset)) | ||
516 | + { | ||
517 | + if (tdep->fpregset == NULL) | ||
518 | + tdep->fpregset = regset_alloc (gdbarch, sh_supply_fpregset, | ||
519 | + sh_collect_fpregset); | ||
520 | + return tdep->fpregset; | ||
521 | + } | ||
522 | + | ||
523 | + return NULL; | ||
524 | +} | ||
525 | + | ||
526 | +/* The register sets used in GNU/Linux ELF core-dumps are identical to | ||
527 | + the register sets in `struct user' that are used for a.out | ||
528 | + core-dumps. These are also used by ptrace(2). The corresponding | ||
529 | + types are `elf_gregset_t' for the general-purpose registers (with | ||
530 | + `elf_greg_t' the type of a single GP register) and `elf_fpregset_t' | ||
531 | + for the floating-point registers. | ||
532 | + | ||
533 | + Those types used to be available under the names `gregset_t' and | ||
534 | + `fpregset_t' too, and GDB used those names in the past. But those | ||
535 | + names are now used for the register sets used in the `mcontext_t' | ||
536 | + type, which have a different size and layout. */ | ||
537 | + | ||
538 | +/* Mapping between the general-purpose registers in `struct user' | ||
539 | + format and GDB's register cache layout. */ | ||
540 | + | ||
541 | +/* From <sys/reg.h>. */ | ||
542 | +static int sh_linux_gregset_reg_offset[] = | ||
543 | +{ | ||
544 | + 0, 4, 8, 12, 16, 20, 24, 28, | ||
545 | + 32, 36, 40, 44, 48, 52, 56, 60, | ||
546 | + | ||
547 | + REG_PC*4, REG_PR*4, REG_GBR*4, -1, | ||
548 | + REG_MACH*4, REG_MACL*4, REG_SR*4, | ||
549 | +}; | ||
550 | + | ||
551 | +/* Mapping between the general-purpose registers in `struct | ||
552 | + sigcontext' format and GDB's register cache layout. */ | ||
553 | + | ||
554 | +/* From <asm/sigcontext.h>. */ | ||
555 | +static int sh_linux_sc_reg_offset[] = | ||
556 | +{ | ||
557 | + 4, 8, 12, 16, 20, 24, 28, 32, | ||
558 | + 36, 40, 44, 48, 52, 56, 60, 64, | ||
559 | + 68, 72, 80, -1, | ||
560 | + 84, 88, 76 | ||
561 | +}; | ||
562 | + | ||
563 | static void | ||
564 | sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||
565 | { | ||
566 | + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | ||
567 | + bfd abfd; | ||
568 | + | ||
569 | + tdep->gregset_reg_offset = sh_linux_gregset_reg_offset; | ||
570 | + tdep->gregset_num_regs = ARRAY_SIZE (sh_linux_gregset_reg_offset); | ||
571 | + tdep->sizeof_gregset = 23 * 4; | ||
572 | + | ||
573 | + tdep->jb_pc_offset = 32; /* From <bits/setjmp.h>. */ | ||
574 | + | ||
575 | + tdep->sigtramp_p = sh_linux_sigtramp_p; | ||
576 | + tdep->sigcontext_addr = sh_linux_sigcontext_addr; | ||
577 | + tdep->sc_reg_offset = sh_linux_sc_reg_offset; | ||
578 | + tdep->sc_num_regs = ARRAY_SIZE (sh_linux_sc_reg_offset); | ||
579 | + | ||
580 | + frame_unwind_append_unwinder(gdbarch, &sh_linux_sigtramp_frame_unwind); | ||
581 | + | ||
582 | + /* If we have a register mapping, enable the generic core file | ||
583 | + support, unless it has already been enabled. */ | ||
584 | + if (tdep->gregset_reg_offset | ||
585 | + && !gdbarch_regset_from_core_section_p (gdbarch)) | ||
586 | + set_gdbarch_regset_from_core_section (gdbarch, | ||
587 | + sh_linux_regset_from_core_section); | ||
588 | + | ||
589 | linux_init_abi (info, gdbarch); | ||
590 | |||
591 | /* GNU/Linux uses SVR4-style shared libraries. */ | ||
592 | Index: gdb-7.4/gdb/sh-tdep.h | ||
593 | =================================================================== | ||
594 | --- gdb-7.4.orig/gdb/sh-tdep.h 2012-04-24 07:06:35.101317178 -0700 | ||
595 | +++ gdb-7.4/gdb/sh-tdep.h 2012-04-24 07:09:14.369324886 -0700 | ||
596 | @@ -21,6 +21,12 @@ | ||
597 | |||
598 | /* Contributed by Steve Chamberlain sac@cygnus.com. */ | ||
599 | |||
600 | +struct frame_info; | ||
601 | +struct gdbarch; | ||
602 | +struct reggroup; | ||
603 | +struct regset; | ||
604 | +struct regcache; | ||
605 | + | ||
606 | /* Registers for all SH variants. Used also by sh3-rom.c. */ | ||
607 | enum | ||
608 | { | ||
609 | @@ -29,6 +35,7 @@ | ||
610 | ARG0_REGNUM = 4, | ||
611 | ARGLAST_REGNUM = 7, | ||
612 | FP_REGNUM = 14, | ||
613 | + SP_REGNUM = 15, | ||
614 | PC_REGNUM = 16, | ||
615 | PR_REGNUM = 17, | ||
616 | GBR_REGNUM = 18, | ||
617 | @@ -82,8 +89,26 @@ | ||
618 | FV_LAST_REGNUM = 79 | ||
619 | }; | ||
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 | extern gdbarch_init_ftype sh64_gdbarch_init; | ||
639 | extern void sh64_show_regs (struct frame_info *); | ||
640 | +extern struct sh_frame_cache *sh_frame_cache (struct frame_info *next_frame, void **this_cache); | ||
641 | |||
642 | /* This structure describes a register in a core-file. */ | ||
643 | struct sh_corefile_regmap | ||
644 | @@ -92,8 +117,32 @@ | ||
645 | unsigned int offset; | ||
646 | }; | ||
647 | |||
648 | +/* sh architecture specific information. */ | ||
649 | struct gdbarch_tdep | ||
650 | { | ||
651 | + /* General-purpose registers. */ | ||
652 | + struct regset *gregset; | ||
653 | + int *gregset_reg_offset; | ||
654 | + int gregset_num_regs; | ||
655 | + size_t sizeof_gregset; | ||
656 | + | ||
657 | + /* Floating-point registers. */ | ||
658 | + struct regset *fpregset; | ||
659 | + size_t sizeof_fpregset; | ||
660 | + | ||
661 | + /* Offset of saved PC in jmp_buf. */ | ||
662 | + int jb_pc_offset; | ||
663 | + | ||
664 | + /* Detect sigtramp. */ | ||
665 | + int (*sigtramp_p) (struct frame_info *); | ||
666 | + | ||
667 | + /* Get address of sigcontext for sigtramp. */ | ||
668 | + CORE_ADDR (*sigcontext_addr) (struct frame_info *); | ||
669 | + | ||
670 | + /* Offset of registers in `struct sigcontext'. */ | ||
671 | + int *sc_reg_offset; | ||
672 | + int sc_num_regs; | ||
673 | + | ||
674 | /* Non-NULL when debugging from a core file. Provides the offset | ||
675 | where each general-purpose register is stored inside the associated | ||
676 | core file section. */ | ||
677 | Index: gdb-7.4/gdb/sh-linux-nat.c | ||
678 | =================================================================== | ||
679 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
680 | +++ gdb-7.4/gdb/sh-linux-nat.c 2012-04-24 07:09:28.557325573 -0700 | ||
681 | @@ -0,0 +1,269 @@ | ||
682 | +/* Low level SH interface to ptrace, for GDB when running native. | ||
683 | + Copyright (C) 2002, 2004 Free Software Foundation, Inc. | ||
684 | + | ||
685 | +This file is part of GDB. | ||
686 | + | ||
687 | +This program is free software; you can redistribute it and/or modify | ||
688 | +it under the terms of the GNU General Public License as published by | ||
689 | +the Free Software Foundation; either version 2 of the License, or | ||
690 | +(at your option) any later version. | ||
691 | + | ||
692 | +This program is distributed in the hope that it will be useful, | ||
693 | +but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
694 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
695 | +GNU General Public License for more details. | ||
696 | + | ||
697 | +You should have received a copy of the GNU General Public License | ||
698 | +along with this program; if not, write to the Free Software | ||
699 | +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
700 | + | ||
701 | +#include "defs.h" | ||
702 | +#include "inferior.h" | ||
703 | +#include "gdbcore.h" | ||
704 | +#include "regcache.h" | ||
705 | +#include "linux-nat.h" | ||
706 | +#include "target.h" | ||
707 | +#include "arch-utils.h" | ||
708 | + | ||
709 | +#include "gdb_assert.h" | ||
710 | +#include "gdb_string.h" | ||
711 | +#include <sys/ptrace.h> | ||
712 | +#include <sys/user.h> | ||
713 | +#include <sys/procfs.h> | ||
714 | +#include <asm/ptrace.h> | ||
715 | + | ||
716 | +/* Prototypes for supply_gregset etc. */ | ||
717 | +#include "gregset.h" | ||
718 | +#include "sh-tdep.h" | ||
719 | + | ||
720 | +/* Defines ps_err_e, struct ps_prochandle. */ | ||
721 | +#include "gdb_proc_service.h" | ||
722 | + | ||
723 | +//#include <asm/elf.h> | ||
724 | + | ||
725 | +#define SH_LINUX_NUM_REGS 40 | ||
726 | +/* This table must line up with REGISTER_NAME in "sh-tdep.c". */ | ||
727 | +static const int regmap[] = | ||
728 | +{ | ||
729 | + /* general registers 0-15 */ | ||
730 | + REG_REG0 , REG_REG0+1 , REG_REG0+2 , REG_REG0+3, | ||
731 | + REG_REG0+4 , REG_REG0+5 , REG_REG0+6 , REG_REG0+7, | ||
732 | + REG_REG0+8 , REG_REG0+9 , REG_REG0+10, REG_REG0+11, | ||
733 | + REG_REG0+12, REG_REG0+13, REG_REG0+14, REG_REG0+15, | ||
734 | + /* 16 - 22 */ | ||
735 | + REG_PC, REG_PR, REG_GBR, -1, REG_MACH, REG_MACL, REG_SR, | ||
736 | + /* 23, 24 */ | ||
737 | + REG_FPUL, REG_FPSCR, | ||
738 | + /* floating point registers 25 - 40 */ | ||
739 | + REG_FPREG0 , REG_FPREG0+1 , REG_FPREG0+2 , REG_FPREG0+3 , | ||
740 | + REG_FPREG0+4 , REG_FPREG0+5 , REG_FPREG0+6 , REG_FPREG0+7 , | ||
741 | + REG_FPREG0+8 , REG_FPREG0+9 , REG_FPREG0+10, REG_FPREG0+11, | ||
742 | + REG_FPREG0+12, REG_FPREG0+13, REG_FPREG0+14, REG_FPREG0+15, | ||
743 | +}; | ||
744 | + | ||
745 | +CORE_ADDR | ||
746 | +register_u_addr (CORE_ADDR blockend, int regnum) | ||
747 | +{ | ||
748 | + if (regnum < 0 || regnum >= sizeof regmap/sizeof regmap[0]) | ||
749 | + return (CORE_ADDR)-1; | ||
750 | + return (blockend + 4 * regmap[regnum]); | ||
751 | +} | ||
752 | + | ||
753 | + | ||
754 | +/* Return the address in the core dump or inferior of register REGNO. | ||
755 | + BLOCKEND is the address of the end of the user structure. */ | ||
756 | + | ||
757 | +CORE_ADDR | ||
758 | +register_addr (int regno, CORE_ADDR blockend) | ||
759 | +{ | ||
760 | + CORE_ADDR addr; | ||
761 | + | ||
762 | + if (regno < 0 || regno >= SH_LINUX_NUM_REGS) { | ||
763 | + internal_error (__FILE__, __LINE__, | ||
764 | + _("Got request for bad register number %d."), regno); | ||
765 | + } | ||
766 | + | ||
767 | + REGISTER_U_ADDR (addr, blockend, regno); | ||
768 | + | ||
769 | + return addr; | ||
770 | +} | ||
771 | + | ||
772 | +/* Fetch one register. */ | ||
773 | + | ||
774 | +static void | ||
775 | +fetch_register (struct regcache *regcache, int tid, int regno) | ||
776 | +{ | ||
777 | + int val; | ||
778 | + | ||
779 | + if (cannot_fetch_register (regno)) | ||
780 | + { | ||
781 | + regcache_raw_supply (regcache, regno, NULL); | ||
782 | + return; | ||
783 | + } | ||
784 | + | ||
785 | + errno = 0; | ||
786 | + val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0); | ||
787 | + if (errno != 0) | ||
788 | + perror_with_name (_("Couldn't get registers")); | ||
789 | + | ||
790 | + regcache_raw_supply (regcache, regno, &val); | ||
791 | +} | ||
792 | + | ||
793 | +/* Store one register. */ | ||
794 | + | ||
795 | +static void | ||
796 | +store_register (struct regcache *regcache, int tid, int regno) | ||
797 | +{ | ||
798 | + int val; | ||
799 | + | ||
800 | + if (cannot_store_register (regno)) | ||
801 | + return; | ||
802 | + | ||
803 | + errno = 0; | ||
804 | + regcache_raw_collect (regcache, regno, &val); | ||
805 | + ptrace (PTRACE_POKEUSER, tid, register_addr (regno, 0), val); | ||
806 | + if (errno != 0) | ||
807 | + perror_with_name (_("Couldn't write registers")); | ||
808 | +} | ||
809 | + | ||
810 | +/* Transfering the general-purpose registers between GDB, inferiors | ||
811 | + and core files. */ | ||
812 | + | ||
813 | +/* Fill GDB's register array with the general-purpose register values | ||
814 | + in *GREGSETP. */ | ||
815 | + | ||
816 | +void | ||
817 | +supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp) | ||
818 | +{ | ||
819 | + elf_greg_t *regp = (elf_greg_t *) gregsetp; | ||
820 | + int i; | ||
821 | + | ||
822 | + for (i = 0; i < 23; i++) | ||
823 | + if (regmap[i] == -1) | ||
824 | + regcache_raw_supply (regcache, i, NULL); | ||
825 | + else | ||
826 | + regcache_raw_supply (regcache, i, (char *) (regp + regmap[i])); | ||
827 | +} | ||
828 | + | ||
829 | +/* Fill register REGNO (if it is a general-purpose register) in | ||
830 | + *GREGSETPS with the value in GDB's register array. If REGNO is -1, | ||
831 | + do this for all registers. */ | ||
832 | + | ||
833 | +void | ||
834 | +fill_gregset (const struct regcache *regcache, elf_gregset_t *gregsetp, int regno) | ||
835 | +{ | ||
836 | + elf_greg_t *regp = (elf_greg_t *) gregsetp; | ||
837 | + int i; | ||
838 | + | ||
839 | + for (i = 0; i < 23; i++) | ||
840 | + if (regmap[i] != -1 && (regno == -1 || regno == i)) | ||
841 | + regcache_raw_collect (regcache, i, (char *) (regp + regmap[i])); | ||
842 | +} | ||
843 | + | ||
844 | +/* Transfering floating-point registers between GDB, inferiors and cores. */ | ||
845 | + | ||
846 | +/* Fill GDB's register array with the floating-point register values in | ||
847 | + *FPREGSETP. */ | ||
848 | + | ||
849 | +void | ||
850 | +supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp) | ||
851 | +{ | ||
852 | + int i; | ||
853 | + long *regp = (long *)fpregsetp; | ||
854 | + | ||
855 | + for (i = 0; i < 16; i++) | ||
856 | + regcache_raw_supply (regcache, 25 + i, (char *) (regp + i)); | ||
857 | + regcache_raw_supply (regcache, FPUL_REGNUM, (char *) (regp + REG_FPUL - REG_FPREG0)); | ||
858 | + regcache_raw_supply (regcache, FPSCR_REGNUM, (char *) (regp + REG_FPSCR - REG_FPREG0)); | ||
859 | +} | ||
860 | + | ||
861 | +/* Fill register REGNO (if it is a floating-point register) in | ||
862 | + *FPREGSETP with the value in GDB's register array. If REGNO is -1, | ||
863 | + do this for all registers. */ | ||
864 | + | ||
865 | +void | ||
866 | +fill_fpregset (const struct regcache *regcache, elf_fpregset_t *fpregsetp, int regno) | ||
867 | +{ | ||
868 | + int i; | ||
869 | + long *regp = (long *)fpregsetp; | ||
870 | + | ||
871 | + for (i = 0; i < 16; i++) | ||
872 | + if ((regno == -1) || (regno == i)) | ||
873 | + regcache_raw_collect (regcache, 25 + i, (char *) (regp + i)); | ||
874 | + if ((regno == -1) || regno == FPSCR_REGNUM) | ||
875 | + regcache_raw_collect (regcache, FPSCR_REGNUM, (char *) (regp + REG_FPSCR - REG_FPREG0)); | ||
876 | + if ((regno == -1) || regno == FPUL_REGNUM) | ||
877 | + regcache_raw_collect (regcache, FPUL_REGNUM, (char *) (regp + REG_FPUL - REG_FPREG0)); | ||
878 | +} | ||
879 | + | ||
880 | +/* Transferring arbitrary registers between GDB and inferior. */ | ||
881 | + | ||
882 | +/* Check if register REGNO in the child process is accessible. | ||
883 | + If we are accessing registers directly via the U area, only the | ||
884 | + general-purpose registers are available. | ||
885 | + All registers should be accessible if we have GETREGS support. */ | ||
886 | + | ||
887 | +int | ||
888 | +cannot_fetch_register (int regno) | ||
889 | +{ | ||
890 | + return (regno < 0 || regno >= sizeof regmap / sizeof regmap[0] || regmap[regno] == -1); | ||
891 | +} | ||
892 | + | ||
893 | +int | ||
894 | +cannot_store_register (int regno) | ||
895 | +{ | ||
896 | + return (regno < 0 || regno >= sizeof regmap / sizeof regmap[0] || regmap[regno] == -1); | ||
897 | +} | ||
898 | + | ||
899 | +/* Fetch register values from the inferior. | ||
900 | + If REGNO is negative, do this for all registers. | ||
901 | + Otherwise, REGNO specifies which register (so we can save time). */ | ||
902 | + | ||
903 | +static void | ||
904 | +sh_linux_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno) | ||
905 | +{ | ||
906 | + int i; | ||
907 | + int tid; | ||
908 | + | ||
909 | + /* GNU/Linux LWP ID's are process ID's. */ | ||
910 | + if ((tid = TIDGET (inferior_ptid)) == 0) | ||
911 | + tid = PIDGET (inferior_ptid); /* Not a threaded program. */ | ||
912 | + | ||
913 | + for (i = 0; i < SH_LINUX_NUM_REGS; i++) | ||
914 | + if (regno == -1 || regno == i) | ||
915 | + fetch_register (regcache, tid, i); | ||
916 | +} | ||
917 | +/* Store our register values back into the inferior. | ||
918 | + If REGNO is negative, do this for all registers. | ||
919 | + Otherwise, REGNO specifies which register (so we can save time). */ | ||
920 | + | ||
921 | +static void | ||
922 | +sh_linux_store_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno) | ||
923 | +{ | ||
924 | + int i; | ||
925 | + int tid; | ||
926 | + | ||
927 | + /* GNU/Linux LWP ID's are process ID's. */ | ||
928 | + if ((tid = TIDGET (inferior_ptid)) == 0) | ||
929 | + tid = PIDGET (inferior_ptid); /* Not a threaded program. */ | ||
930 | + | ||
931 | + for (i = 0; i < SH_LINUX_NUM_REGS; i++) | ||
932 | + if (regno == -1 || regno == i) | ||
933 | + store_register (regcache, tid, i); | ||
934 | +} | ||
935 | + | ||
936 | +void | ||
937 | +_initialize_sh_linux_nat (void) | ||
938 | +{ | ||
939 | + struct target_ops *t; | ||
940 | + | ||
941 | + /* Fill in the generic GNU/Linux methods. */ | ||
942 | + t = linux_target (); | ||
943 | + | ||
944 | + /* Add our register access methods. */ | ||
945 | + t->to_fetch_registers = sh_linux_fetch_inferior_registers; | ||
946 | + t->to_store_registers = sh_linux_store_inferior_registers; | ||
947 | + | ||
948 | + /* Register the target. */ | ||
949 | + linux_nat_add_target (t); | ||
950 | +} | ||
951 | Index: gdb-7.4/gdb/sh-tdep.c | ||
952 | =================================================================== | ||
953 | --- gdb-7.4.orig/gdb/sh-tdep.c 2012-04-24 07:06:35.109317179 -0700 | ||
954 | +++ gdb-7.4/gdb/sh-tdep.c 2012-04-24 07:09:14.369324886 -0700 | ||
955 | @@ -21,6 +21,9 @@ | ||
956 | sac@cygnus.com. */ | ||
957 | |||
958 | #include "defs.h" | ||
959 | +#include "arch-utils.h" | ||
960 | +#include "command.h" | ||
961 | +#include "dummy-frame.h" | ||
962 | #include "frame.h" | ||
963 | #include "frame-base.h" | ||
964 | #include "frame-unwind.h" | ||
965 | @@ -37,6 +40,7 @@ | ||
966 | #include "arch-utils.h" | ||
967 | #include "floatformat.h" | ||
968 | #include "regcache.h" | ||
969 | +#include "regset.h" | ||
970 | #include "doublest.h" | ||
971 | #include "osabi.h" | ||
972 | #include "reggroups.h" | ||
973 | @@ -69,23 +73,6 @@ | ||
974 | |||
975 | static void (*sh_show_regs) (struct frame_info *); | ||
976 | |||
977 | -#define SH_NUM_REGS 67 | ||
978 | - | ||
979 | -struct sh_frame_cache | ||
980 | -{ | ||
981 | - /* Base address. */ | ||
982 | - CORE_ADDR base; | ||
983 | - LONGEST sp_offset; | ||
984 | - CORE_ADDR pc; | ||
985 | - | ||
986 | - /* Flag showing that a frame has been created in the prologue code. */ | ||
987 | - int uses_fp; | ||
988 | - | ||
989 | - /* Saved registers. */ | ||
990 | - CORE_ADDR saved_regs[SH_NUM_REGS]; | ||
991 | - CORE_ADDR saved_sp; | ||
992 | -}; | ||
993 | - | ||
994 | static int | ||
995 | sh_is_renesas_calling_convention (struct type *func_type) | ||
996 | { | ||
997 | @@ -1040,7 +1027,7 @@ | ||
998 | return 0; | ||
999 | /* Otherwise if the type of that member is float, the whole type is | ||
1000 | treated as float. */ | ||
1001 | - if (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_FLT) | ||
1002 | + if (TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, 0))) == TYPE_CODE_FLT) | ||
1003 | return 1; | ||
1004 | /* Otherwise it's not treated as float. */ | ||
1005 | return 0; | ||
1006 | @@ -1090,7 +1077,7 @@ | ||
1007 | in four registers available. Loop thru args from first to last. */ | ||
1008 | for (argnum = 0; argnum < nargs; argnum++) | ||
1009 | { | ||
1010 | - type = value_type (args[argnum]); | ||
1011 | + type = check_typedef (value_type (args[argnum])); | ||
1012 | len = TYPE_LENGTH (type); | ||
1013 | val = sh_justify_value_in_reg (gdbarch, args[argnum], len); | ||
1014 | |||
1015 | @@ -2508,7 +2495,7 @@ | ||
1016 | reg->how = DWARF2_FRAME_REG_UNDEFINED; | ||
1017 | } | ||
1018 | |||
1019 | -static struct sh_frame_cache * | ||
1020 | +struct sh_frame_cache * | ||
1021 | sh_alloc_frame_cache (void) | ||
1022 | { | ||
1023 | struct sh_frame_cache *cache; | ||
1024 | @@ -2535,7 +2522,7 @@ | ||
1025 | return cache; | ||
1026 | } | ||
1027 | |||
1028 | -static struct sh_frame_cache * | ||
1029 | +struct sh_frame_cache * | ||
1030 | sh_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
1031 | { | ||
1032 | struct gdbarch *gdbarch = get_frame_arch (this_frame); | ||
1033 | @@ -2593,9 +2580,9 @@ | ||
1034 | return cache; | ||
1035 | } | ||
1036 | |||
1037 | -static struct value * | ||
1038 | -sh_frame_prev_register (struct frame_info *this_frame, | ||
1039 | - void **this_cache, int regnum) | ||
1040 | +struct value * | ||
1041 | +sh_frame_prev_register (struct frame_info *this_frame, void **this_cache, | ||
1042 | + int regnum) | ||
1043 | { | ||
1044 | struct gdbarch *gdbarch = get_frame_arch (this_frame); | ||
1045 | struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache); | ||
1046 | @@ -2609,7 +2596,7 @@ | ||
1047 | the current frame. Frob regnum so that we pull the value from | ||
1048 | the correct place. */ | ||
1049 | if (regnum == gdbarch_pc_regnum (gdbarch)) | ||
1050 | - regnum = PR_REGNUM; | ||
1051 | + regnum = PR_REGNUM; /* XXX: really? */ | ||
1052 | |||
1053 | if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1) | ||
1054 | return frame_unwind_got_memory (this_frame, regnum, | ||
1055 | @@ -2853,8 +2840,8 @@ | ||
1056 | static struct gdbarch * | ||
1057 | sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
1058 | { | ||
1059 | - struct gdbarch *gdbarch; | ||
1060 | struct gdbarch_tdep *tdep; | ||
1061 | + struct gdbarch *gdbarch; | ||
1062 | |||
1063 | sh_show_regs = sh_generic_show_regs; | ||
1064 | switch (info.bfd_arch_info->mach) | ||
1065 | @@ -2917,6 +2904,18 @@ | ||
1066 | tdep = XZALLOC (struct gdbarch_tdep); | ||
1067 | gdbarch = gdbarch_alloc (&info, tdep); | ||
1068 | |||
1069 | + /* General-purpose registers. */ | ||
1070 | + tdep->gregset = NULL; | ||
1071 | + tdep->gregset_reg_offset = NULL; | ||
1072 | + tdep->gregset_num_regs = 23; | ||
1073 | + tdep->sizeof_gregset = 0; | ||
1074 | + | ||
1075 | + /* Floating-point registers. */ | ||
1076 | + tdep->fpregset = NULL; | ||
1077 | + tdep->sizeof_fpregset = 34*4; | ||
1078 | + | ||
1079 | + tdep->jb_pc_offset = -1; | ||
1080 | + | ||
1081 | set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); | ||
1082 | set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT); | ||
1083 | set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); | ||
1084 | @@ -3062,10 +3061,11 @@ | ||
1085 | break; | ||
1086 | } | ||
1087 | |||
1088 | + dwarf2_append_unwinders (gdbarch); | ||
1089 | + | ||
1090 | /* Hook in ABI-specific overrides, if they have been registered. */ | ||
1091 | gdbarch_init_osabi (info, gdbarch); | ||
1092 | |||
1093 | - dwarf2_append_unwinders (gdbarch); | ||
1094 | frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind); | ||
1095 | |||
1096 | return gdbarch; | ||
1097 | Index: gdb-7.4/gdb/testsuite/gdb.asm/sh-linux.inc | ||
1098 | =================================================================== | ||
1099 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
1100 | +++ gdb-7.4/gdb/testsuite/gdb.asm/sh-linux.inc 2012-04-24 07:09:14.369324886 -0700 | ||
1101 | @@ -0,0 +1,78 @@ | ||
1102 | +# You'll find a bunch of nop opcodes in the below macros. They are | ||
1103 | +# there to keep the code correctly aligned. Be careful to maintain | ||
1104 | +# them when changing the code. | ||
1105 | + | ||
1106 | + comment "subroutine declare" | ||
1107 | + .purgem gdbasm_declare | ||
1108 | + .macro gdbasm_declare name | ||
1109 | + .align 1 | ||
1110 | + .global \name | ||
1111 | +\name: | ||
1112 | + .endm | ||
1113 | + | ||
1114 | + comment "subroutine prologue" | ||
1115 | + .macro gdbasm_enter | ||
1116 | + mov.l r14,@-r15 | ||
1117 | + sts.l pr,@-r15 | ||
1118 | + mov r15,r14 | ||
1119 | + nop | ||
1120 | + .endm | ||
1121 | + | ||
1122 | + comment "subroutine epilogue" | ||
1123 | + .macro gdbasm_leave | ||
1124 | + mov r14,r15 | ||
1125 | + lds.l @r15+,pr | ||
1126 | + mov.l @r15+,r14 | ||
1127 | + rts | ||
1128 | + nop | ||
1129 | + nop | ||
1130 | + .endm | ||
1131 | + | ||
1132 | + comment "subroutine end" | ||
1133 | + .purgem gdbasm_end | ||
1134 | + .macro gdbasm_end name | ||
1135 | + .size \name, .-_foo1 | ||
1136 | + .align 1 | ||
1137 | + .endm | ||
1138 | + | ||
1139 | + comment "subroutine call" | ||
1140 | + .macro gdbasm_call subr | ||
1141 | + mov.l .Lconst\@,r1 | ||
1142 | + bra .Lafterconst\@ | ||
1143 | + nop | ||
1144 | + .align 2 | ||
1145 | +.Lconst\@: | ||
1146 | + .long \subr | ||
1147 | +.Lafterconst\@: | ||
1148 | + jsr @r1 | ||
1149 | + nop | ||
1150 | + .endm | ||
1151 | + | ||
1152 | + .macro gdbasm_several_nops | ||
1153 | + nop | ||
1154 | + nop | ||
1155 | + nop | ||
1156 | + nop | ||
1157 | + .endm | ||
1158 | + | ||
1159 | + comment "exit (0)" | ||
1160 | + .macro gdbasm_exit0 | ||
1161 | + sleep | ||
1162 | + nop | ||
1163 | + .endm | ||
1164 | + | ||
1165 | + comment "crt0 startup" | ||
1166 | + .macro gdbasm_startup | ||
1167 | + mov #0,r14 | ||
1168 | + .endm | ||
1169 | + | ||
1170 | + comment "Declare a data variable" | ||
1171 | + .purgem gdbasm_datavar | ||
1172 | + .macro gdbasm_datavar name value | ||
1173 | + .data | ||
1174 | + .align 2 | ||
1175 | + .type \name, @object | ||
1176 | + .size \name, 4 | ||
1177 | +\name: | ||
1178 | + .long \value | ||
1179 | + .endm | ||
1180 | Index: gdb-7.4/gdb/testsuite/gdb.asm/sh.inc | ||
1181 | =================================================================== | ||
1182 | --- gdb-7.4.orig/gdb/testsuite/gdb.asm/sh.inc 2012-04-24 07:06:35.001317175 -0700 | ||
1183 | +++ gdb-7.4/gdb/testsuite/gdb.asm/sh.inc 2012-04-24 07:09:14.369324886 -0700 | ||
1184 | @@ -40,9 +40,8 @@ | ||
1185 | mov.l .Lconst\@,r1 | ||
1186 | bra .Lafterconst\@ | ||
1187 | nop | ||
1188 | - nop | ||
1189 | -.Lconst\@: | ||
1190 | .align 2 | ||
1191 | +.Lconst\@: | ||
1192 | .long \subr | ||
1193 | .align 1 | ||
1194 | .Lafterconst\@: | ||
1195 | Index: gdb-7.4/gdb/testsuite/gdb.asm/asm-source.exp | ||
1196 | =================================================================== | ||
1197 | --- gdb-7.4.orig/gdb/testsuite/gdb.asm/asm-source.exp 2012-04-24 07:06:35.009317179 -0700 | ||
1198 | +++ gdb-7.4/gdb/testsuite/gdb.asm/asm-source.exp 2012-04-24 07:09:14.369324886 -0700 | ||
1199 | @@ -110,6 +110,11 @@ | ||
1200 | append link-flags " -m elf32ppc" | ||
1201 | } | ||
1202 | } | ||
1203 | + "sh*-linux*" { | ||
1204 | + set asm-arch sh-linux | ||
1205 | + set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}" | ||
1206 | + set debug-flags "-gdwarf-2" | ||
1207 | + } | ||
1208 | "sh*-*-*" { | ||
1209 | set asm-arch sh | ||
1210 | set debug-flags "-gdwarf-2" | ||
1211 | Index: gdb-7.4/gdb/testsuite/gdb.base/sigall.c | ||
1212 | =================================================================== | ||
1213 | --- gdb-7.4.orig/gdb/testsuite/gdb.base/sigall.c 2012-04-24 07:06:35.037317176 -0700 | ||
1214 | +++ gdb-7.4/gdb/testsuite/gdb.base/sigall.c 2012-04-24 07:09:14.369324886 -0700 | ||
1215 | @@ -1,9 +1,9 @@ | ||
1216 | #include <signal.h> | ||
1217 | #include <unistd.h> | ||
1218 | |||
1219 | -#ifdef __sh__ | ||
1220 | -#define signal(a,b) /* Signals not supported on this target - make them go away */ | ||
1221 | -#endif | ||
1222 | + | ||
1223 | + | ||
1224 | + | ||
1225 | |||
1226 | /* Signal handlers, we set breakpoints in them to make sure that the | ||
1227 | signals really get delivered. */ | ||
1228 | Index: gdb-7.4/gdb/testsuite/gdb.base/signals.c | ||
1229 | =================================================================== | ||
1230 | --- gdb-7.4.orig/gdb/testsuite/gdb.base/signals.c 2012-04-24 07:06:35.049317176 -0700 | ||
1231 | +++ gdb-7.4/gdb/testsuite/gdb.base/signals.c 2012-04-24 07:09:14.373324884 -0700 | ||
1232 | @@ -3,10 +3,10 @@ | ||
1233 | #include <signal.h> | ||
1234 | #include <unistd.h> | ||
1235 | |||
1236 | -#ifdef __sh__ | ||
1237 | -#define signal(a,b) /* Signals not supported on this target - make them go away */ | ||
1238 | -#define alarm(a) /* Ditto for alarm() */ | ||
1239 | -#endif | ||
1240 | + | ||
1241 | + | ||
1242 | + | ||
1243 | + | ||
1244 | |||
1245 | static int count = 0; | ||
1246 | |||
1247 | Index: gdb-7.4/gdb/testsuite/gdb.base/annota1.c | ||
1248 | =================================================================== | ||
1249 | --- gdb-7.4.orig/gdb/testsuite/gdb.base/annota1.c 2012-04-24 07:06:35.021317172 -0700 | ||
1250 | +++ gdb-7.4/gdb/testsuite/gdb.base/annota1.c 2012-04-24 07:09:14.373324884 -0700 | ||
1251 | @@ -1,9 +1,9 @@ | ||
1252 | #include <stdio.h> | ||
1253 | #include <signal.h> | ||
1254 | |||
1255 | -#ifdef __sh__ | ||
1256 | -#define signal(a,b) /* Signals not supported on this target - make them go away */ | ||
1257 | -#endif | ||
1258 | + | ||
1259 | + | ||
1260 | + | ||
1261 | |||
1262 | |||
1263 | #ifdef PROTOTYPES | ||
1264 | Index: gdb-7.4/gdb/testsuite/gdb.base/annota3.c | ||
1265 | =================================================================== | ||
1266 | --- gdb-7.4.orig/gdb/testsuite/gdb.base/annota3.c 2012-04-24 07:06:35.029317176 -0700 | ||
1267 | +++ gdb-7.4/gdb/testsuite/gdb.base/annota3.c 2012-04-24 07:09:14.373324884 -0700 | ||
1268 | @@ -1,9 +1,9 @@ | ||
1269 | #include <stdio.h> | ||
1270 | #include <signal.h> | ||
1271 | |||
1272 | -#ifdef __sh__ | ||
1273 | -#define signal(a,b) /* Signals not supported on this target - make them go away */ | ||
1274 | -#endif | ||
1275 | + | ||
1276 | + | ||
1277 | + | ||
1278 | |||
1279 | |||
1280 | #ifdef PROTOTYPES | ||
1281 | Index: gdb-7.4/gdb/config/sh/xm-linux.h | ||
1282 | =================================================================== | ||
1283 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
1284 | +++ gdb-7.4/gdb/config/sh/xm-linux.h 2012-04-24 07:09:14.373324884 -0700 | ||
1285 | @@ -0,0 +1,32 @@ | ||
1286 | +/* Native support for GNU/Linux, for GDB, the GNU debugger. | ||
1287 | + Copyright (C) 2000 Free Software Foundation, Inc. | ||
1288 | + | ||
1289 | +This file is part of GDB. | ||
1290 | + | ||
1291 | +This program is free software; you can redistribute it and/or modify | ||
1292 | +it under the terms of the GNU General Public License as published by | ||
1293 | +the Free Software Foundation; either version 2 of the License, or | ||
1294 | +(at your option) any later version. | ||
1295 | + | ||
1296 | +This program is distributed in the hope that it will be useful, | ||
1297 | +but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1298 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1299 | +GNU General Public License for more details. | ||
1300 | + | ||
1301 | +You should have received a copy of the GNU General Public License | ||
1302 | +along with this program; if not, write to the Free Software | ||
1303 | +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
1304 | + | ||
1305 | +#ifndef XM_LINUX_H | ||
1306 | +#define XM_LINUX_H | ||
1307 | + | ||
1308 | +#define HOST_BYTE_ORDER LITTLE_ENDIAN | ||
1309 | + | ||
1310 | +#define HAVE_TERMIOS | ||
1311 | + | ||
1312 | +#define NEED_POSIX_SETPGID | ||
1313 | + | ||
1314 | +/* Need R_OK etc, but USG isn't defined. */ | ||
1315 | +#include <unistd.h> | ||
1316 | + | ||
1317 | +#endif /* #ifndef XM_LINUX_H */ | ||
1318 | Index: gdb-7.4/gdb/config/sh/nm-linux.h | ||
1319 | =================================================================== | ||
1320 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
1321 | +++ gdb-7.4/gdb/config/sh/nm-linux.h 2012-04-24 07:09:14.373324884 -0700 | ||
1322 | @@ -0,0 +1,54 @@ | ||
1323 | +/* Native-dependent definitions for SuperH running Linux, for GDB. | ||
1324 | + Copyright 2004 Free Software Foundation, Inc. | ||
1325 | + | ||
1326 | + This file is part of GDB. | ||
1327 | + | ||
1328 | + This program is free software; you can redistribute it and/or modify | ||
1329 | + it under the terms of the GNU General Public License as published by | ||
1330 | + the Free Software Foundation; either version 2 of the License, or | ||
1331 | + (at your option) any later version. | ||
1332 | + | ||
1333 | + This program is distributed in the hope that it will be useful, | ||
1334 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1335 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1336 | + GNU General Public License for more details. | ||
1337 | + | ||
1338 | + You should have received a copy of the GNU General Public License | ||
1339 | + along with this program; if not, write to the Free Software | ||
1340 | + Foundation, Inc., 59 Temple Place - Suite 330, | ||
1341 | + Boston, MA 02111-1307, USA. */ | ||
1342 | + | ||
1343 | +#ifndef NM_LINUX_H | ||
1344 | +#define NM_LINUX_H | ||
1345 | + | ||
1346 | +/* Get generic Linux native definitions. */ | ||
1347 | +#include "config/nm-linux.h" | ||
1348 | +/* Support for the user area. */ | ||
1349 | + | ||
1350 | +/* Return the size of the user struct. */ | ||
1351 | +extern int kernel_u_size (void); | ||
1352 | +#define KERNEL_U_SIZE kernel_u_size() | ||
1353 | + | ||
1354 | +/* This is the amount to substract from u.u_ar0 to get the offset in | ||
1355 | + the core file of the register values. */ | ||
1356 | +#define KERNEL_U_ADDR 0 | ||
1357 | + | ||
1358 | +#define U_REGS_OFFSET 0 | ||
1359 | + | ||
1360 | +extern CORE_ADDR register_u_addr (CORE_ADDR blockend, int regnum); | ||
1361 | +#define REGISTER_U_ADDR(addr, blockend, regnum) \ | ||
1362 | + (addr) = register_u_addr (blockend, regnum) | ||
1363 | + | ||
1364 | +/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */ | ||
1365 | +#define FETCH_INFERIOR_REGISTERS | ||
1366 | + | ||
1367 | +/* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we | ||
1368 | + might fall back on the code `infptrace.c' (well a copy of that code | ||
1369 | + in `sh-linux-nat.c' for now) and we can access only the | ||
1370 | + general-purpose registers in that way. */ | ||
1371 | +extern int cannot_fetch_register (int regno); | ||
1372 | +extern int cannot_store_register (int regno); | ||
1373 | +#define CANNOT_FETCH_REGISTER(regno) cannot_fetch_register (regno) | ||
1374 | +#define CANNOT_STORE_REGISTER(regno) cannot_store_register (regno) | ||
1375 | + | ||
1376 | +#endif /* NM_LINUX_H */ | ||
1377 | Index: gdb-7.4/gdb/config/sh/linux.mh | ||
1378 | =================================================================== | ||
1379 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
1380 | +++ gdb-7.4/gdb/config/sh/linux.mh 2012-04-24 07:36:11.709403160 -0700 | ||
1381 | @@ -0,0 +1,8 @@ | ||
1382 | +# Host: Renesas Super-H running GNU/Linux | ||
1383 | +NAT_FILE= config/sh/nm-linux.h | ||
1384 | +NATDEPFILES= inf-ptrace.o fork-child.o corelow.o sh-linux-nat.o \ | ||
1385 | + proc-service.o linux-thread-db.o gcore.o \ | ||
1386 | + linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o | ||
1387 | + | ||
1388 | +NAT_CDEPS = $(srcdir)/proc-service.list | ||
1389 | +LOADLIBES= -ldl $(RDYNAMIC) | ||