1 /* Target-dependent code for GDB, the GNU debugger.
3 Copyright (C) 1986-2014 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
33 #include "solib-svr4.h"
34 #include "solib-spu.h"
38 #include "ppc64-tdep.h"
39 #include "ppc-linux-tdep.h"
40 #include "glibc-tdep.h"
41 #include "trad-frame.h"
42 #include "frame-unwind.h"
43 #include "tramp-frame.h"
46 #include "elf/common.h"
47 #include "elf/ppc64.h"
48 #include "arch-utils.h"
50 #include "xml-syscall.h"
51 #include "linux-tdep.h"
53 #include "stap-probe.h"
56 #include "cli/cli-utils.h"
57 #include "parser-defs.h"
58 #include "user-regs.h"
60 #include "elf-bfd.h" /* for elfcore_write_* */
62 #include "features/rs6000/powerpc-32l.c"
63 #include "features/rs6000/powerpc-altivec32l.c"
64 #include "features/rs6000/powerpc-cell32l.c"
65 #include "features/rs6000/powerpc-vsx32l.c"
66 #include "features/rs6000/powerpc-isa205-32l.c"
67 #include "features/rs6000/powerpc-isa205-altivec32l.c"
68 #include "features/rs6000/powerpc-isa205-vsx32l.c"
69 #include "features/rs6000/powerpc-64l.c"
70 #include "features/rs6000/powerpc-altivec64l.c"
71 #include "features/rs6000/powerpc-cell64l.c"
72 #include "features/rs6000/powerpc-vsx64l.c"
73 #include "features/rs6000/powerpc-isa205-64l.c"
74 #include "features/rs6000/powerpc-isa205-altivec64l.c"
75 #include "features/rs6000/powerpc-isa205-vsx64l.c"
76 #include "features/rs6000/powerpc-e500l.c"
78 /* Shared library operations for PowerPC-Linux. */
79 static struct target_so_ops powerpc_so_ops;
81 /* The syscall's XML filename for PPC and PPC64. */
82 #define XML_SYSCALL_FILENAME_PPC "syscalls/ppc-linux.xml"
83 #define XML_SYSCALL_FILENAME_PPC64 "syscalls/ppc64-linux.xml"
85 /* ppc_linux_memory_remove_breakpoints attempts to remove a breakpoint
86 in much the same fashion as memory_remove_breakpoint in mem-break.c,
87 but is careful not to write back the previous contents if the code
88 in question has changed in between inserting the breakpoint and
91 Here is the problem that we're trying to solve...
93 Once upon a time, before introducing this function to remove
94 breakpoints from the inferior, setting a breakpoint on a shared
95 library function prior to running the program would not work
96 properly. In order to understand the problem, it is first
97 necessary to understand a little bit about dynamic linking on
100 A call to a shared library function is accomplished via a bl
101 (branch-and-link) instruction whose branch target is an entry
102 in the procedure linkage table (PLT). The PLT in the object
103 file is uninitialized. To gdb, prior to running the program, the
104 entries in the PLT are all zeros.
106 Once the program starts running, the shared libraries are loaded
107 and the procedure linkage table is initialized, but the entries in
108 the table are not (necessarily) resolved. Once a function is
109 actually called, the code in the PLT is hit and the function is
110 resolved. In order to better illustrate this, an example is in
111 order; the following example is from the gdb testsuite.
113 We start the program shmain.
115 [kev@arroyo testsuite]$ ../gdb gdb.base/shmain
118 We place two breakpoints, one on shr1 and the other on main.
121 Breakpoint 1 at 0x100409d4
123 Breakpoint 2 at 0x100006a0: file gdb.base/shmain.c, line 44.
125 Examine the instruction (and the immediatly following instruction)
126 upon which the breakpoint was placed. Note that the PLT entry
127 for shr1 contains zeros.
129 (gdb) x/2i 0x100409d4
130 0x100409d4 <shr1>: .long 0x0
131 0x100409d8 <shr1+4>: .long 0x0
136 Starting program: gdb.base/shmain
137 Breakpoint 1 at 0xffaf790: file gdb.base/shr1.c, line 19.
139 Breakpoint 2, main ()
140 at gdb.base/shmain.c:44
143 Examine the PLT again. Note that the loading of the shared
144 library has initialized the PLT to code which loads a constant
145 (which I think is an index into the GOT) into r11 and then
146 branchs a short distance to the code which actually does the
149 (gdb) x/2i 0x100409d4
150 0x100409d4 <shr1>: li r11,4
151 0x100409d8 <shr1+4>: b 0x10040984 <sg+4>
155 Breakpoint 1, shr1 (x=1)
156 at gdb.base/shr1.c:19
159 Now we've hit the breakpoint at shr1. (The breakpoint was
160 reset from the PLT entry to the actual shr1 function after the
161 shared library was loaded.) Note that the PLT entry has been
162 resolved to contain a branch that takes us directly to shr1.
163 (The real one, not the PLT entry.)
165 (gdb) x/2i 0x100409d4
166 0x100409d4 <shr1>: b 0xffaf76c <shr1>
167 0x100409d8 <shr1+4>: b 0x10040984 <sg+4>
169 The thing to note here is that the PLT entry for shr1 has been
172 Now the problem should be obvious. GDB places a breakpoint (a
173 trap instruction) on the zero value of the PLT entry for shr1.
174 Later on, after the shared library had been loaded and the PLT
175 initialized, GDB gets a signal indicating this fact and attempts
176 (as it always does when it stops) to remove all the breakpoints.
178 The breakpoint removal was causing the former contents (a zero
179 word) to be written back to the now initialized PLT entry thus
180 destroying a portion of the initialization that had occurred only a
181 short time ago. When execution continued, the zero word would be
182 executed as an instruction an illegal instruction trap was
183 generated instead. (0 is not a legal instruction.)
185 The fix for this problem was fairly straightforward. The function
186 memory_remove_breakpoint from mem-break.c was copied to this file,
187 modified slightly, and renamed to ppc_linux_memory_remove_breakpoint.
188 In tm-linux.h, MEMORY_REMOVE_BREAKPOINT is defined to call this new
191 The differences between ppc_linux_memory_remove_breakpoint () and
192 memory_remove_breakpoint () are minor. All that the former does
193 that the latter does not is check to make sure that the breakpoint
194 location actually contains a breakpoint (trap instruction) prior
195 to attempting to write back the old contents. If it does contain
196 a trap instruction, we allow the old contents to be written back.
197 Otherwise, we silently do nothing.
199 The big question is whether memory_remove_breakpoint () should be
200 changed to have the same functionality. The downside is that more
201 traffic is generated for remote targets since we'll have an extra
202 fetch of a memory word each time a breakpoint is removed.
204 For the time being, we'll leave this self-modifying-code-friendly
205 version in ppc-linux-tdep.c, but it ought to be migrated somewhere
206 else in the event that some other platform has similar needs with
207 regard to removing breakpoints in some potentially self modifying
210 ppc_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
211 struct bp_target_info *bp_tgt)
213 CORE_ADDR addr = bp_tgt->reqstd_address;
214 const unsigned char *bp;
217 gdb_byte old_contents[BREAKPOINT_MAX];
218 struct cleanup *cleanup;
220 /* Determine appropriate breakpoint contents and size for this address. */
221 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
223 error (_("Software breakpoints not implemented for this target."));
225 /* Make sure we see the memory breakpoints. */
226 cleanup = make_show_memory_breakpoints_cleanup (1);
227 val = target_read_memory (addr, old_contents, bplen);
229 /* If our breakpoint is no longer at the address, this means that the
230 program modified the code on us, so it is wrong to put back the
232 if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
233 val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
235 do_cleanups (cleanup);
239 /* For historic reasons, PPC 32 GNU/Linux follows PowerOpen rather
240 than the 32 bit SYSV R4 ABI structure return convention - all
241 structures, no matter their size, are put in memory. Vectors,
242 which were added later, do get returned in a register though. */
244 static enum return_value_convention
245 ppc_linux_return_value (struct gdbarch *gdbarch, struct value *function,
246 struct type *valtype, struct regcache *regcache,
247 gdb_byte *readbuf, const gdb_byte *writebuf)
249 if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
250 || TYPE_CODE (valtype) == TYPE_CODE_UNION)
251 && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8)
252 && TYPE_VECTOR (valtype)))
253 return RETURN_VALUE_STRUCT_CONVENTION;
255 return ppc_sysv_abi_return_value (gdbarch, function, valtype, regcache,
259 /* PLT stub in executable. */
260 static struct ppc_insn_pattern powerpc32_plt_stub[] =
262 { 0xffff0000, 0x3d600000, 0 }, /* lis r11, xxxx */
263 { 0xffff0000, 0x816b0000, 0 }, /* lwz r11, xxxx(r11) */
264 { 0xffffffff, 0x7d6903a6, 0 }, /* mtctr r11 */
265 { 0xffffffff, 0x4e800420, 0 }, /* bctr */
269 /* PLT stub in shared library. */
270 static struct ppc_insn_pattern powerpc32_plt_stub_so[] =
272 { 0xffff0000, 0x817e0000, 0 }, /* lwz r11, xxxx(r30) */
273 { 0xffffffff, 0x7d6903a6, 0 }, /* mtctr r11 */
274 { 0xffffffff, 0x4e800420, 0 }, /* bctr */
275 { 0xffffffff, 0x60000000, 0 }, /* nop */
278 #define POWERPC32_PLT_STUB_LEN ARRAY_SIZE (powerpc32_plt_stub)
280 /* Check if PC is in PLT stub. For non-secure PLT, stub is in .plt
281 section. For secure PLT, stub is in .text and we need to check
282 instruction patterns. */
285 powerpc_linux_in_dynsym_resolve_code (CORE_ADDR pc)
287 struct bound_minimal_symbol sym;
289 /* Check whether PC is in the dynamic linker. This also checks
290 whether it is in the .plt section, used by non-PIC executables. */
291 if (svr4_in_dynsym_resolve_code (pc))
294 /* Check if we are in the resolver. */
295 sym = lookup_minimal_symbol_by_pc (pc);
296 if (sym.minsym != NULL
297 && (strcmp (MSYMBOL_LINKAGE_NAME (sym.minsym), "__glink") == 0
298 || strcmp (MSYMBOL_LINKAGE_NAME (sym.minsym),
299 "__glink_PLTresolve") == 0))
305 /* Follow PLT stub to actual routine. */
308 ppc_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
310 unsigned int insnbuf[POWERPC32_PLT_STUB_LEN];
311 struct gdbarch *gdbarch = get_frame_arch (frame);
312 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
313 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
314 CORE_ADDR target = 0;
316 if (ppc_insns_match_pattern (frame, pc, powerpc32_plt_stub, insnbuf))
321 Branch target is in r11. */
323 target = (ppc_insn_d_field (insnbuf[0]) << 16)
324 | ppc_insn_d_field (insnbuf[1]);
325 target = read_memory_unsigned_integer (target, 4, byte_order);
328 if (ppc_insns_match_pattern (frame, pc, powerpc32_plt_stub_so, insnbuf))
332 Branch target is in r11. */
334 target = get_frame_register_unsigned (frame, tdep->ppc_gp0_regnum + 30)
335 + ppc_insn_d_field (insnbuf[0]);
336 target = read_memory_unsigned_integer (target, 4, byte_order);
342 /* Wrappers to handle Linux-only registers. */
345 ppc_linux_supply_gregset (const struct regset *regset,
346 struct regcache *regcache,
347 int regnum, const void *gregs, size_t len)
349 const struct ppc_reg_offsets *offsets = regset->regmap;
351 ppc_supply_gregset (regset, regcache, regnum, gregs, len);
353 if (ppc_linux_trap_reg_p (get_regcache_arch (regcache)))
355 /* "orig_r3" is stored 2 slots after "pc". */
356 if (regnum == -1 || regnum == PPC_ORIG_R3_REGNUM)
357 ppc_supply_reg (regcache, PPC_ORIG_R3_REGNUM, gregs,
358 offsets->pc_offset + 2 * offsets->gpr_size,
361 /* "trap" is stored 8 slots after "pc". */
362 if (regnum == -1 || regnum == PPC_TRAP_REGNUM)
363 ppc_supply_reg (regcache, PPC_TRAP_REGNUM, gregs,
364 offsets->pc_offset + 8 * offsets->gpr_size,
370 ppc_linux_collect_gregset (const struct regset *regset,
371 const struct regcache *regcache,
372 int regnum, void *gregs, size_t len)
374 const struct ppc_reg_offsets *offsets = regset->regmap;
376 /* Clear areas in the linux gregset not written elsewhere. */
378 memset (gregs, 0, len);
380 ppc_collect_gregset (regset, regcache, regnum, gregs, len);
382 if (ppc_linux_trap_reg_p (get_regcache_arch (regcache)))
384 /* "orig_r3" is stored 2 slots after "pc". */
385 if (regnum == -1 || regnum == PPC_ORIG_R3_REGNUM)
386 ppc_collect_reg (regcache, PPC_ORIG_R3_REGNUM, gregs,
387 offsets->pc_offset + 2 * offsets->gpr_size,
390 /* "trap" is stored 8 slots after "pc". */
391 if (regnum == -1 || regnum == PPC_TRAP_REGNUM)
392 ppc_collect_reg (regcache, PPC_TRAP_REGNUM, gregs,
393 offsets->pc_offset + 8 * offsets->gpr_size,
398 /* Regset descriptions. */
399 static const struct ppc_reg_offsets ppc32_linux_reg_offsets =
401 /* General-purpose registers. */
402 /* .r0_offset = */ 0,
405 /* .pc_offset = */ 128,
406 /* .ps_offset = */ 132,
407 /* .cr_offset = */ 152,
408 /* .lr_offset = */ 144,
409 /* .ctr_offset = */ 140,
410 /* .xer_offset = */ 148,
411 /* .mq_offset = */ 156,
413 /* Floating-point registers. */
414 /* .f0_offset = */ 0,
415 /* .fpscr_offset = */ 256,
416 /* .fpscr_size = */ 8,
418 /* AltiVec registers. */
419 /* .vr0_offset = */ 0,
420 /* .vscr_offset = */ 512 + 12,
421 /* .vrsave_offset = */ 528
424 static const struct ppc_reg_offsets ppc64_linux_reg_offsets =
426 /* General-purpose registers. */
427 /* .r0_offset = */ 0,
430 /* .pc_offset = */ 256,
431 /* .ps_offset = */ 264,
432 /* .cr_offset = */ 304,
433 /* .lr_offset = */ 288,
434 /* .ctr_offset = */ 280,
435 /* .xer_offset = */ 296,
436 /* .mq_offset = */ 312,
438 /* Floating-point registers. */
439 /* .f0_offset = */ 0,
440 /* .fpscr_offset = */ 256,
441 /* .fpscr_size = */ 8,
443 /* AltiVec registers. */
444 /* .vr0_offset = */ 0,
445 /* .vscr_offset = */ 512 + 12,
446 /* .vrsave_offset = */ 528
449 static const struct regset ppc32_linux_gregset = {
450 &ppc32_linux_reg_offsets,
451 ppc_linux_supply_gregset,
452 ppc_linux_collect_gregset
455 static const struct regset ppc64_linux_gregset = {
456 &ppc64_linux_reg_offsets,
457 ppc_linux_supply_gregset,
458 ppc_linux_collect_gregset
461 static const struct regset ppc32_linux_fpregset = {
462 &ppc32_linux_reg_offsets,
467 static const struct regset ppc32_linux_vrregset = {
468 &ppc32_linux_reg_offsets,
473 static const struct regset ppc32_linux_vsxregset = {
474 &ppc32_linux_reg_offsets,
475 ppc_supply_vsxregset,
476 ppc_collect_vsxregset
479 const struct regset *
480 ppc_linux_gregset (int wordsize)
482 return wordsize == 8 ? &ppc64_linux_gregset : &ppc32_linux_gregset;
485 const struct regset *
486 ppc_linux_fpregset (void)
488 return &ppc32_linux_fpregset;
491 /* Iterate over supported core file register note sections. */
494 ppc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
495 iterate_over_regset_sections_cb *cb,
497 const struct regcache *regcache)
499 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
500 int have_altivec = tdep->ppc_vr0_regnum != -1;
501 int have_vsx = tdep->ppc_vsr0_upper_regnum != -1;
503 if (tdep->wordsize == 4)
504 cb (".reg", 48 * 4, &ppc32_linux_gregset, NULL, cb_data);
506 cb (".reg", 48 * 8, &ppc64_linux_gregset, NULL, cb_data);
508 cb (".reg2", 264, &ppc32_linux_fpregset, NULL, cb_data);
511 cb (".reg-ppc-vmx", 544, &ppc32_linux_vrregset, "ppc Altivec", cb_data);
514 cb (".reg-ppc-vsx", 256, &ppc32_linux_vsxregset, "POWER7 VSX", cb_data);
518 ppc_linux_sigtramp_cache (struct frame_info *this_frame,
519 struct trad_frame_cache *this_cache,
520 CORE_ADDR func, LONGEST offset,
528 struct gdbarch *gdbarch = get_frame_arch (this_frame);
529 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
530 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
532 base = get_frame_register_unsigned (this_frame,
533 gdbarch_sp_regnum (gdbarch));
534 if (bias > 0 && get_frame_pc (this_frame) != func)
535 /* See below, some signal trampolines increment the stack as their
536 first instruction, need to compensate for that. */
539 /* Find the address of the register buffer pointer. */
540 regs = base + offset;
541 /* Use that to find the address of the corresponding register
543 gpregs = read_memory_unsigned_integer (regs, tdep->wordsize, byte_order);
544 fpregs = gpregs + 48 * tdep->wordsize;
546 /* General purpose. */
547 for (i = 0; i < 32; i++)
549 int regnum = i + tdep->ppc_gp0_regnum;
550 trad_frame_set_reg_addr (this_cache,
551 regnum, gpregs + i * tdep->wordsize);
553 trad_frame_set_reg_addr (this_cache,
554 gdbarch_pc_regnum (gdbarch),
555 gpregs + 32 * tdep->wordsize);
556 trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum,
557 gpregs + 35 * tdep->wordsize);
558 trad_frame_set_reg_addr (this_cache, tdep->ppc_lr_regnum,
559 gpregs + 36 * tdep->wordsize);
560 trad_frame_set_reg_addr (this_cache, tdep->ppc_xer_regnum,
561 gpregs + 37 * tdep->wordsize);
562 trad_frame_set_reg_addr (this_cache, tdep->ppc_cr_regnum,
563 gpregs + 38 * tdep->wordsize);
565 if (ppc_linux_trap_reg_p (gdbarch))
567 trad_frame_set_reg_addr (this_cache, PPC_ORIG_R3_REGNUM,
568 gpregs + 34 * tdep->wordsize);
569 trad_frame_set_reg_addr (this_cache, PPC_TRAP_REGNUM,
570 gpregs + 40 * tdep->wordsize);
573 if (ppc_floating_point_unit_p (gdbarch))
575 /* Floating point registers. */
576 for (i = 0; i < 32; i++)
578 int regnum = i + gdbarch_fp0_regnum (gdbarch);
579 trad_frame_set_reg_addr (this_cache, regnum,
580 fpregs + i * tdep->wordsize);
582 trad_frame_set_reg_addr (this_cache, tdep->ppc_fpscr_regnum,
583 fpregs + 32 * tdep->wordsize);
585 trad_frame_set_id (this_cache, frame_id_build (base, func));
589 ppc32_linux_sigaction_cache_init (const struct tramp_frame *self,
590 struct frame_info *this_frame,
591 struct trad_frame_cache *this_cache,
594 ppc_linux_sigtramp_cache (this_frame, this_cache, func,
595 0xd0 /* Offset to ucontext_t. */
596 + 0x30 /* Offset to .reg. */,
601 ppc64_linux_sigaction_cache_init (const struct tramp_frame *self,
602 struct frame_info *this_frame,
603 struct trad_frame_cache *this_cache,
606 ppc_linux_sigtramp_cache (this_frame, this_cache, func,
607 0x80 /* Offset to ucontext_t. */
608 + 0xe0 /* Offset to .reg. */,
613 ppc32_linux_sighandler_cache_init (const struct tramp_frame *self,
614 struct frame_info *this_frame,
615 struct trad_frame_cache *this_cache,
618 ppc_linux_sigtramp_cache (this_frame, this_cache, func,
619 0x40 /* Offset to ucontext_t. */
620 + 0x1c /* Offset to .reg. */,
625 ppc64_linux_sighandler_cache_init (const struct tramp_frame *self,
626 struct frame_info *this_frame,
627 struct trad_frame_cache *this_cache,
630 ppc_linux_sigtramp_cache (this_frame, this_cache, func,
631 0x80 /* Offset to struct sigcontext. */
632 + 0x38 /* Offset to .reg. */,
636 static struct tramp_frame ppc32_linux_sigaction_tramp_frame = {
640 { 0x380000ac, -1 }, /* li r0, 172 */
641 { 0x44000002, -1 }, /* sc */
642 { TRAMP_SENTINEL_INSN },
644 ppc32_linux_sigaction_cache_init
646 static struct tramp_frame ppc64_linux_sigaction_tramp_frame = {
650 { 0x38210080, -1 }, /* addi r1,r1,128 */
651 { 0x380000ac, -1 }, /* li r0, 172 */
652 { 0x44000002, -1 }, /* sc */
653 { TRAMP_SENTINEL_INSN },
655 ppc64_linux_sigaction_cache_init
657 static struct tramp_frame ppc32_linux_sighandler_tramp_frame = {
661 { 0x38000077, -1 }, /* li r0,119 */
662 { 0x44000002, -1 }, /* sc */
663 { TRAMP_SENTINEL_INSN },
665 ppc32_linux_sighandler_cache_init
667 static struct tramp_frame ppc64_linux_sighandler_tramp_frame = {
671 { 0x38210080, -1 }, /* addi r1,r1,128 */
672 { 0x38000077, -1 }, /* li r0,119 */
673 { 0x44000002, -1 }, /* sc */
674 { TRAMP_SENTINEL_INSN },
676 ppc64_linux_sighandler_cache_init
680 /* Address to use for displaced stepping. When debugging a stand-alone
681 SPU executable, entry_point_address () will point to an SPU local-store
682 address and is thus not usable as displaced stepping location. We use
683 the auxiliary vector to determine the PowerPC-side entry point address
686 static CORE_ADDR ppc_linux_entry_point_addr = 0;
689 ppc_linux_inferior_created (struct target_ops *target, int from_tty)
691 ppc_linux_entry_point_addr = 0;
695 ppc_linux_displaced_step_location (struct gdbarch *gdbarch)
697 if (ppc_linux_entry_point_addr == 0)
701 /* Determine entry point from target auxiliary vector. */
702 if (target_auxv_search (¤t_target, AT_ENTRY, &addr) <= 0)
703 error (_("Cannot find AT_ENTRY auxiliary vector entry."));
705 /* Make certain that the address points at real code, and not a
706 function descriptor. */
707 addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
710 /* Inferior calls also use the entry point as a breakpoint location.
711 We don't want displaced stepping to interfere with those
712 breakpoints, so leave space. */
713 ppc_linux_entry_point_addr = addr + 2 * PPC_INSN_SIZE;
716 return ppc_linux_entry_point_addr;
720 /* Return 1 if PPC_ORIG_R3_REGNUM and PPC_TRAP_REGNUM are usable. */
722 ppc_linux_trap_reg_p (struct gdbarch *gdbarch)
724 /* If we do not have a target description with registers, then
725 the special registers will not be included in the register set. */
726 if (!tdesc_has_registers (gdbarch_target_desc (gdbarch)))
729 /* If we do, then it is safe to check the size. */
730 return register_size (gdbarch, PPC_ORIG_R3_REGNUM) > 0
731 && register_size (gdbarch, PPC_TRAP_REGNUM) > 0;
734 /* Return the current system call's number present in the
735 r0 register. When the function fails, it returns -1. */
737 ppc_linux_get_syscall_number (struct gdbarch *gdbarch,
740 struct regcache *regcache = get_thread_regcache (ptid);
741 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
742 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
743 struct cleanup *cleanbuf;
744 /* The content of a register */
749 /* Make sure we're in a 32- or 64-bit machine */
750 gdb_assert (tdep->wordsize == 4 || tdep->wordsize == 8);
752 buf = (gdb_byte *) xmalloc (tdep->wordsize * sizeof (gdb_byte));
754 cleanbuf = make_cleanup (xfree, buf);
756 /* Getting the system call number from the register.
757 When dealing with PowerPC architecture, this information
758 is stored at 0th register. */
759 regcache_cooked_read (regcache, tdep->ppc_gp0_regnum, buf);
761 ret = extract_signed_integer (buf, tdep->wordsize, byte_order);
762 do_cleanups (cleanbuf);
768 ppc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
770 struct gdbarch *gdbarch = get_regcache_arch (regcache);
772 regcache_cooked_write_unsigned (regcache, gdbarch_pc_regnum (gdbarch), pc);
774 /* Set special TRAP register to -1 to prevent the kernel from
775 messing with the PC we just installed, if we happen to be
776 within an interrupted system call that the kernel wants to
779 Note that after we return from the dummy call, the TRAP and
780 ORIG_R3 registers will be automatically restored, and the
781 kernel continues to restart the system call at this point. */
782 if (ppc_linux_trap_reg_p (gdbarch))
783 regcache_cooked_write_unsigned (regcache, PPC_TRAP_REGNUM, -1);
787 ppc_linux_spu_section (bfd *abfd, asection *asect, void *user_data)
789 return strncmp (bfd_section_name (abfd, asect), "SPU/", 4) == 0;
792 static const struct target_desc *
793 ppc_linux_core_read_description (struct gdbarch *gdbarch,
794 struct target_ops *target,
797 asection *cell = bfd_sections_find_if (abfd, ppc_linux_spu_section, NULL);
798 asection *altivec = bfd_get_section_by_name (abfd, ".reg-ppc-vmx");
799 asection *vsx = bfd_get_section_by_name (abfd, ".reg-ppc-vsx");
800 asection *section = bfd_get_section_by_name (abfd, ".reg");
804 switch (bfd_section_size (abfd, section))
808 return tdesc_powerpc_cell32l;
810 return tdesc_powerpc_vsx32l;
812 return tdesc_powerpc_altivec32l;
814 return tdesc_powerpc_32l;
818 return tdesc_powerpc_cell64l;
820 return tdesc_powerpc_vsx64l;
822 return tdesc_powerpc_altivec64l;
824 return tdesc_powerpc_64l;
832 /* Implementation of `gdbarch_elf_make_msymbol_special', as defined in
833 gdbarch.h. This implementation is used for the ELFv2 ABI only. */
836 ppc_elfv2_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
838 elf_symbol_type *elf_sym = (elf_symbol_type *)sym;
840 /* If the symbol is marked as having a local entry point, set a target
841 flag in the msymbol. We currently only support local entry point
842 offsets of 8 bytes, which is the only entry point offset ever used
843 by current compilers. If/when other offsets are ever used, we will
844 have to use additional target flag bits to store them. */
845 switch (PPC64_LOCAL_ENTRY_OFFSET (elf_sym->internal_elf_sym.st_other))
850 MSYMBOL_TARGET_FLAG_1 (msym) = 1;
855 /* Implementation of `gdbarch_skip_entrypoint', as defined in
856 gdbarch.h. This implementation is used for the ELFv2 ABI only. */
859 ppc_elfv2_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR pc)
861 struct bound_minimal_symbol fun;
862 int local_entry_offset = 0;
864 fun = lookup_minimal_symbol_by_pc (pc);
865 if (fun.minsym == NULL)
868 /* See ppc_elfv2_elf_make_msymbol_special for how local entry point
869 offset values are encoded. */
870 if (MSYMBOL_TARGET_FLAG_1 (fun.minsym))
871 local_entry_offset = 8;
873 if (BMSYMBOL_VALUE_ADDRESS (fun) <= pc
874 && pc < BMSYMBOL_VALUE_ADDRESS (fun) + local_entry_offset)
875 return BMSYMBOL_VALUE_ADDRESS (fun) + local_entry_offset;
880 /* Implementation of `gdbarch_stap_is_single_operand', as defined in
884 ppc_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
886 return (*s == 'i' /* Literal number. */
887 || (isdigit (*s) && s[1] == '('
888 && isdigit (s[2])) /* Displacement. */
889 || (*s == '(' && isdigit (s[1])) /* Register indirection. */
890 || isdigit (*s)); /* Register value. */
893 /* Implementation of `gdbarch_stap_parse_special_token', as defined in
897 ppc_stap_parse_special_token (struct gdbarch *gdbarch,
898 struct stap_parse_info *p)
900 if (isdigit (*p->arg))
902 /* This temporary pointer is needed because we have to do a lookahead.
903 We could be dealing with a register displacement, and in such case
904 we would not need to do anything. */
905 const char *s = p->arg;
915 /* It is a register displacement indeed. Returning 0 means we are
916 deferring the treatment of this case to the generic parser. */
921 regname = alloca (len + 2);
924 strncpy (regname + 1, p->arg, len);
928 if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1)
929 error (_("Invalid register name `%s' on expression `%s'."),
930 regname, p->saved_arg);
932 write_exp_elt_opcode (&p->pstate, OP_REGISTER);
935 write_exp_string (&p->pstate, str);
936 write_exp_elt_opcode (&p->pstate, OP_REGISTER);
942 /* All the other tokens should be handled correctly by the generic
950 /* Cell/B.E. active SPE context tracking support. */
952 static struct objfile *spe_context_objfile = NULL;
953 static CORE_ADDR spe_context_lm_addr = 0;
954 static CORE_ADDR spe_context_offset = 0;
956 static ptid_t spe_context_cache_ptid;
957 static CORE_ADDR spe_context_cache_address;
959 /* Hook into inferior_created, solib_loaded, and solib_unloaded observers
960 to track whether we've loaded a version of libspe2 (as static or dynamic
961 library) that provides the __spe_current_active_context variable. */
963 ppc_linux_spe_context_lookup (struct objfile *objfile)
965 struct bound_minimal_symbol sym;
969 spe_context_objfile = NULL;
970 spe_context_lm_addr = 0;
971 spe_context_offset = 0;
972 spe_context_cache_ptid = minus_one_ptid;
973 spe_context_cache_address = 0;
977 sym = lookup_minimal_symbol ("__spe_current_active_context", NULL, objfile);
980 spe_context_objfile = objfile;
981 spe_context_lm_addr = svr4_fetch_objfile_link_map (objfile);
982 spe_context_offset = BMSYMBOL_VALUE_ADDRESS (sym);
983 spe_context_cache_ptid = minus_one_ptid;
984 spe_context_cache_address = 0;
990 ppc_linux_spe_context_inferior_created (struct target_ops *t, int from_tty)
992 struct objfile *objfile;
994 ppc_linux_spe_context_lookup (NULL);
995 ALL_OBJFILES (objfile)
996 ppc_linux_spe_context_lookup (objfile);
1000 ppc_linux_spe_context_solib_loaded (struct so_list *so)
1002 if (strstr (so->so_original_name, "/libspe") != NULL)
1004 solib_read_symbols (so, 0);
1005 ppc_linux_spe_context_lookup (so->objfile);
1010 ppc_linux_spe_context_solib_unloaded (struct so_list *so)
1012 if (so->objfile == spe_context_objfile)
1013 ppc_linux_spe_context_lookup (NULL);
1016 /* Retrieve contents of the N'th element in the current thread's
1017 linked SPE context list into ID and NPC. Return the address of
1018 said context element, or 0 if not found. */
1020 ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
1021 int n, int *id, unsigned int *npc)
1023 CORE_ADDR spe_context = 0;
1027 /* Quick exit if we have not found __spe_current_active_context. */
1028 if (!spe_context_objfile)
1031 /* Look up cached address of thread-local variable. */
1032 if (!ptid_equal (spe_context_cache_ptid, inferior_ptid))
1034 struct target_ops *target = ¤t_target;
1035 volatile struct gdb_exception ex;
1037 TRY_CATCH (ex, RETURN_MASK_ERROR)
1039 /* We do not call target_translate_tls_address here, because
1040 svr4_fetch_objfile_link_map may invalidate the frame chain,
1041 which must not do while inside a frame sniffer.
1043 Instead, we have cached the lm_addr value, and use that to
1044 directly call the target's to_get_thread_local_address. */
1045 spe_context_cache_address
1046 = target->to_get_thread_local_address (target, inferior_ptid,
1047 spe_context_lm_addr,
1048 spe_context_offset);
1049 spe_context_cache_ptid = inferior_ptid;
1056 /* Read variable value. */
1057 if (target_read_memory (spe_context_cache_address, buf, wordsize) == 0)
1058 spe_context = extract_unsigned_integer (buf, wordsize, byte_order);
1060 /* Cyle through to N'th linked list element. */
1061 for (i = 0; i < n && spe_context; i++)
1062 if (target_read_memory (spe_context + align_up (12, wordsize),
1063 buf, wordsize) == 0)
1064 spe_context = extract_unsigned_integer (buf, wordsize, byte_order);
1068 /* Read current context. */
1070 && target_read_memory (spe_context, buf, 12) != 0)
1073 /* Extract data elements. */
1077 *id = extract_signed_integer (buf, 4, byte_order);
1079 *npc = extract_unsigned_integer (buf + 4, 4, byte_order);
1086 /* Cell/B.E. cross-architecture unwinder support. */
1088 struct ppu2spu_cache
1090 struct frame_id frame_id;
1091 struct regcache *regcache;
1094 static struct gdbarch *
1095 ppu2spu_prev_arch (struct frame_info *this_frame, void **this_cache)
1097 struct ppu2spu_cache *cache = *this_cache;
1098 return get_regcache_arch (cache->regcache);
1102 ppu2spu_this_id (struct frame_info *this_frame,
1103 void **this_cache, struct frame_id *this_id)
1105 struct ppu2spu_cache *cache = *this_cache;
1106 *this_id = cache->frame_id;
1109 static struct value *
1110 ppu2spu_prev_register (struct frame_info *this_frame,
1111 void **this_cache, int regnum)
1113 struct ppu2spu_cache *cache = *this_cache;
1114 struct gdbarch *gdbarch = get_regcache_arch (cache->regcache);
1117 buf = alloca (register_size (gdbarch, regnum));
1119 if (regnum < gdbarch_num_regs (gdbarch))
1120 regcache_raw_read (cache->regcache, regnum, buf);
1122 gdbarch_pseudo_register_read (gdbarch, cache->regcache, regnum, buf);
1124 return frame_unwind_got_bytes (this_frame, regnum, buf);
1129 struct gdbarch *gdbarch;
1132 gdb_byte gprs[128*16];
1136 ppu2spu_unwind_register (void *src, int regnum, gdb_byte *buf)
1138 struct ppu2spu_data *data = src;
1139 enum bfd_endian byte_order = gdbarch_byte_order (data->gdbarch);
1141 if (regnum >= 0 && regnum < SPU_NUM_GPRS)
1142 memcpy (buf, data->gprs + 16*regnum, 16);
1143 else if (regnum == SPU_ID_REGNUM)
1144 store_unsigned_integer (buf, 4, byte_order, data->id);
1145 else if (regnum == SPU_PC_REGNUM)
1146 store_unsigned_integer (buf, 4, byte_order, data->npc);
1148 return REG_UNAVAILABLE;
1154 ppu2spu_sniffer (const struct frame_unwind *self,
1155 struct frame_info *this_frame, void **this_prologue_cache)
1157 struct gdbarch *gdbarch = get_frame_arch (this_frame);
1158 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
1159 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
1160 struct ppu2spu_data data;
1161 struct frame_info *fi;
1162 CORE_ADDR base, func, backchain, spe_context;
1166 /* Count the number of SPU contexts already in the frame chain. */
1167 for (fi = get_next_frame (this_frame); fi; fi = get_next_frame (fi))
1168 if (get_frame_type (fi) == ARCH_FRAME
1169 && gdbarch_bfd_arch_info (get_frame_arch (fi))->arch == bfd_arch_spu)
1172 base = get_frame_sp (this_frame);
1173 func = get_frame_pc (this_frame);
1174 if (target_read_memory (base, buf, tdep->wordsize))
1176 backchain = extract_unsigned_integer (buf, tdep->wordsize, byte_order);
1178 spe_context = ppc_linux_spe_context (tdep->wordsize, byte_order,
1179 n, &data.id, &data.npc);
1180 if (spe_context && base <= spe_context && spe_context < backchain)
1184 /* Find gdbarch for SPU. */
1185 struct gdbarch_info info;
1186 gdbarch_info_init (&info);
1187 info.bfd_arch_info = bfd_lookup_arch (bfd_arch_spu, bfd_mach_spu);
1188 info.byte_order = BFD_ENDIAN_BIG;
1189 info.osabi = GDB_OSABI_LINUX;
1190 info.tdep_info = (void *) &data.id;
1191 data.gdbarch = gdbarch_find_by_info (info);
1195 xsnprintf (annex, sizeof annex, "%d/regs", data.id);
1196 if (target_read (¤t_target, TARGET_OBJECT_SPU, annex,
1197 data.gprs, 0, sizeof data.gprs)
1198 == sizeof data.gprs)
1200 struct ppu2spu_cache *cache
1201 = FRAME_OBSTACK_CALLOC (1, struct ppu2spu_cache);
1203 struct address_space *aspace = get_frame_address_space (this_frame);
1204 struct regcache *regcache = regcache_xmalloc (data.gdbarch, aspace);
1205 struct cleanup *cleanups = make_cleanup_regcache_xfree (regcache);
1206 regcache_save (regcache, ppu2spu_unwind_register, &data);
1207 discard_cleanups (cleanups);
1209 cache->frame_id = frame_id_build (base, func);
1210 cache->regcache = regcache;
1211 *this_prologue_cache = cache;
1220 ppu2spu_dealloc_cache (struct frame_info *self, void *this_cache)
1222 struct ppu2spu_cache *cache = this_cache;
1223 regcache_xfree (cache->regcache);
1226 static const struct frame_unwind ppu2spu_unwind = {
1228 default_frame_unwind_stop_reason,
1230 ppu2spu_prev_register,
1233 ppu2spu_dealloc_cache,
1239 ppc_linux_init_abi (struct gdbarch_info info,
1240 struct gdbarch *gdbarch)
1242 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
1243 struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
1244 static const char *const stap_integer_prefixes[] = { "i", NULL };
1245 static const char *const stap_register_indirection_prefixes[] = { "(",
1247 static const char *const stap_register_indirection_suffixes[] = { ")",
1250 linux_init_abi (info, gdbarch);
1252 /* PPC GNU/Linux uses either 64-bit or 128-bit long doubles; where
1253 128-bit, they are IBM long double, not IEEE quad long double as
1254 in the System V ABI PowerPC Processor Supplement. We can safely
1255 let them default to 128-bit, since the debug info will give the
1256 size of type actually used in each case. */
1257 set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
1258 set_gdbarch_long_double_format (gdbarch, floatformats_ibm_long_double);
1260 /* Handle inferior calls during interrupted system calls. */
1261 set_gdbarch_write_pc (gdbarch, ppc_linux_write_pc);
1263 /* Get the syscall number from the arch's register. */
1264 set_gdbarch_get_syscall_number (gdbarch, ppc_linux_get_syscall_number);
1266 /* SystemTap functions. */
1267 set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
1268 set_gdbarch_stap_register_indirection_prefixes (gdbarch,
1269 stap_register_indirection_prefixes);
1270 set_gdbarch_stap_register_indirection_suffixes (gdbarch,
1271 stap_register_indirection_suffixes);
1272 set_gdbarch_stap_gdb_register_prefix (gdbarch, "r");
1273 set_gdbarch_stap_is_single_operand (gdbarch, ppc_stap_is_single_operand);
1274 set_gdbarch_stap_parse_special_token (gdbarch,
1275 ppc_stap_parse_special_token);
1277 if (tdep->wordsize == 4)
1279 /* Until November 2001, gcc did not comply with the 32 bit SysV
1280 R4 ABI requirement that structures less than or equal to 8
1281 bytes should be returned in registers. Instead GCC was using
1282 the AIX/PowerOpen ABI - everything returned in memory
1283 (well ignoring vectors that is). When this was corrected, it
1284 wasn't fixed for GNU/Linux native platform. Use the
1285 PowerOpen struct convention. */
1286 set_gdbarch_return_value (gdbarch, ppc_linux_return_value);
1288 set_gdbarch_memory_remove_breakpoint (gdbarch,
1289 ppc_linux_memory_remove_breakpoint);
1291 /* Shared library handling. */
1292 set_gdbarch_skip_trampoline_code (gdbarch, ppc_skip_trampoline_code);
1293 set_solib_svr4_fetch_link_map_offsets
1294 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
1296 /* Setting the correct XML syscall filename. */
1297 set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC);
1300 tramp_frame_prepend_unwinder (gdbarch,
1301 &ppc32_linux_sigaction_tramp_frame);
1302 tramp_frame_prepend_unwinder (gdbarch,
1303 &ppc32_linux_sighandler_tramp_frame);
1305 /* BFD target for core files. */
1306 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
1307 set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpcle");
1309 set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpc");
1311 if (powerpc_so_ops.in_dynsym_resolve_code == NULL)
1313 powerpc_so_ops = svr4_so_ops;
1314 /* Override dynamic resolve function. */
1315 powerpc_so_ops.in_dynsym_resolve_code =
1316 powerpc_linux_in_dynsym_resolve_code;
1318 set_solib_ops (gdbarch, &powerpc_so_ops);
1320 set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
1323 if (tdep->wordsize == 8)
1325 if (tdep->elf_abi == POWERPC_ELF_V1)
1327 /* Handle PPC GNU/Linux 64-bit function pointers (which are really
1328 function descriptors). */
1329 set_gdbarch_convert_from_func_ptr_addr
1330 (gdbarch, ppc64_convert_from_func_ptr_addr);
1332 set_gdbarch_elf_make_msymbol_special
1333 (gdbarch, ppc64_elf_make_msymbol_special);
1337 set_gdbarch_elf_make_msymbol_special
1338 (gdbarch, ppc_elfv2_elf_make_msymbol_special);
1340 set_gdbarch_skip_entrypoint (gdbarch, ppc_elfv2_skip_entrypoint);
1343 /* Shared library handling. */
1344 set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
1345 set_solib_svr4_fetch_link_map_offsets
1346 (gdbarch, svr4_lp64_fetch_link_map_offsets);
1348 /* Setting the correct XML syscall filename. */
1349 set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC64);
1352 tramp_frame_prepend_unwinder (gdbarch,
1353 &ppc64_linux_sigaction_tramp_frame);
1354 tramp_frame_prepend_unwinder (gdbarch,
1355 &ppc64_linux_sighandler_tramp_frame);
1357 /* BFD target for core files. */
1358 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
1359 set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpcle");
1361 set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpc");
1364 /* PPC32 uses a different prpsinfo32 compared to most other Linux
1366 if (tdep->wordsize == 4)
1367 set_gdbarch_elfcore_write_linux_prpsinfo (gdbarch,
1368 elfcore_write_ppc_linux_prpsinfo32);
1370 set_gdbarch_core_read_description (gdbarch, ppc_linux_core_read_description);
1371 set_gdbarch_iterate_over_regset_sections (gdbarch,
1372 ppc_linux_iterate_over_regset_sections);
1374 /* Enable TLS support. */
1375 set_gdbarch_fetch_tls_load_module_address (gdbarch,
1376 svr4_fetch_objfile_link_map);
1380 const struct tdesc_feature *feature;
1382 /* If we have target-described registers, then we can safely
1383 reserve a number for PPC_ORIG_R3_REGNUM and PPC_TRAP_REGNUM
1384 (whether they are described or not). */
1385 gdb_assert (gdbarch_num_regs (gdbarch) <= PPC_ORIG_R3_REGNUM);
1386 set_gdbarch_num_regs (gdbarch, PPC_TRAP_REGNUM + 1);
1388 /* If they are present, then assign them to the reserved number. */
1389 feature = tdesc_find_feature (info.target_desc,
1390 "org.gnu.gdb.power.linux");
1391 if (feature != NULL)
1393 tdesc_numbered_register (feature, tdesc_data,
1394 PPC_ORIG_R3_REGNUM, "orig_r3");
1395 tdesc_numbered_register (feature, tdesc_data,
1396 PPC_TRAP_REGNUM, "trap");
1400 /* Enable Cell/B.E. if supported by the target. */
1401 if (tdesc_compatible_p (info.target_desc,
1402 bfd_lookup_arch (bfd_arch_spu, bfd_mach_spu)))
1404 /* Cell/B.E. multi-architecture support. */
1405 set_spu_solib_ops (gdbarch);
1407 /* Cell/B.E. cross-architecture unwinder support. */
1408 frame_unwind_prepend_unwinder (gdbarch, &ppu2spu_unwind);
1410 /* The default displaced_step_at_entry_point doesn't work for
1411 SPU stand-alone executables. */
1412 set_gdbarch_displaced_step_location (gdbarch,
1413 ppc_linux_displaced_step_location);
1416 set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
1419 /* Provide a prototype to silence -Wmissing-prototypes. */
1420 extern initialize_file_ftype _initialize_ppc_linux_tdep;
1423 _initialize_ppc_linux_tdep (void)
1425 /* Register for all sub-familes of the POWER/PowerPC: 32-bit and
1426 64-bit PowerPC, and the older rs6k. */
1427 gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, GDB_OSABI_LINUX,
1428 ppc_linux_init_abi);
1429 gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64, GDB_OSABI_LINUX,
1430 ppc_linux_init_abi);
1431 gdbarch_register_osabi (bfd_arch_rs6000, bfd_mach_rs6k, GDB_OSABI_LINUX,
1432 ppc_linux_init_abi);
1434 /* Attach to inferior_created observer. */
1435 observer_attach_inferior_created (ppc_linux_inferior_created);
1437 /* Attach to observers to track __spe_current_active_context. */
1438 observer_attach_inferior_created (ppc_linux_spe_context_inferior_created);
1439 observer_attach_solib_loaded (ppc_linux_spe_context_solib_loaded);
1440 observer_attach_solib_unloaded (ppc_linux_spe_context_solib_unloaded);
1442 /* Initialize the Linux target descriptions. */
1443 initialize_tdesc_powerpc_32l ();
1444 initialize_tdesc_powerpc_altivec32l ();
1445 initialize_tdesc_powerpc_cell32l ();
1446 initialize_tdesc_powerpc_vsx32l ();
1447 initialize_tdesc_powerpc_isa205_32l ();
1448 initialize_tdesc_powerpc_isa205_altivec32l ();
1449 initialize_tdesc_powerpc_isa205_vsx32l ();
1450 initialize_tdesc_powerpc_64l ();
1451 initialize_tdesc_powerpc_altivec64l ();
1452 initialize_tdesc_powerpc_cell64l ();
1453 initialize_tdesc_powerpc_vsx64l ();
1454 initialize_tdesc_powerpc_isa205_64l ();
1455 initialize_tdesc_powerpc_isa205_altivec64l ();
1456 initialize_tdesc_powerpc_isa205_vsx64l ();
1457 initialize_tdesc_powerpc_e500l ();