1 /* Target-dependent code for GDB, the GNU debugger.
3 Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
4 1997, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
36 #include "solib-svr4.h"
39 /* The following two instructions are used in the signal trampoline
40 code on GNU/Linux PPC. */
41 #define INSTR_LI_R0_0x7777 0x38007777
42 #define INSTR_SC 0x44000002
44 /* Since the *-tdep.c files are platform independent (i.e, they may be
45 used to build cross platform debuggers), we can't include system
46 headers. Therefore, details concerning the sigcontext structure
47 must be painstakingly rerecorded. What's worse, if these details
48 ever change in the header files, they'll have to be changed here
51 /* __SIGNAL_FRAMESIZE from <asm/ptrace.h> */
52 #define PPC_LINUX_SIGNAL_FRAMESIZE 64
54 /* From <asm/sigcontext.h>, offsetof(struct sigcontext_struct, regs) == 0x1c */
55 #define PPC_LINUX_REGS_PTR_OFFSET (PPC_LINUX_SIGNAL_FRAMESIZE + 0x1c)
57 /* From <asm/sigcontext.h>,
58 offsetof(struct sigcontext_struct, handler) == 0x14 */
59 #define PPC_LINUX_HANDLER_PTR_OFFSET (PPC_LINUX_SIGNAL_FRAMESIZE + 0x14)
61 /* From <asm/ptrace.h>, values for PT_NIP, PT_R1, and PT_LNK */
62 #define PPC_LINUX_PT_R0 0
63 #define PPC_LINUX_PT_R1 1
64 #define PPC_LINUX_PT_R2 2
65 #define PPC_LINUX_PT_R3 3
66 #define PPC_LINUX_PT_R4 4
67 #define PPC_LINUX_PT_R5 5
68 #define PPC_LINUX_PT_R6 6
69 #define PPC_LINUX_PT_R7 7
70 #define PPC_LINUX_PT_R8 8
71 #define PPC_LINUX_PT_R9 9
72 #define PPC_LINUX_PT_R10 10
73 #define PPC_LINUX_PT_R11 11
74 #define PPC_LINUX_PT_R12 12
75 #define PPC_LINUX_PT_R13 13
76 #define PPC_LINUX_PT_R14 14
77 #define PPC_LINUX_PT_R15 15
78 #define PPC_LINUX_PT_R16 16
79 #define PPC_LINUX_PT_R17 17
80 #define PPC_LINUX_PT_R18 18
81 #define PPC_LINUX_PT_R19 19
82 #define PPC_LINUX_PT_R20 20
83 #define PPC_LINUX_PT_R21 21
84 #define PPC_LINUX_PT_R22 22
85 #define PPC_LINUX_PT_R23 23
86 #define PPC_LINUX_PT_R24 24
87 #define PPC_LINUX_PT_R25 25
88 #define PPC_LINUX_PT_R26 26
89 #define PPC_LINUX_PT_R27 27
90 #define PPC_LINUX_PT_R28 28
91 #define PPC_LINUX_PT_R29 29
92 #define PPC_LINUX_PT_R30 30
93 #define PPC_LINUX_PT_R31 31
94 #define PPC_LINUX_PT_NIP 32
95 #define PPC_LINUX_PT_MSR 33
96 #define PPC_LINUX_PT_CTR 35
97 #define PPC_LINUX_PT_LNK 36
98 #define PPC_LINUX_PT_XER 37
99 #define PPC_LINUX_PT_CCR 38
100 #define PPC_LINUX_PT_MQ 39
101 #define PPC_LINUX_PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
102 #define PPC_LINUX_PT_FPR31 (PPC_LINUX_PT_FPR0 + 2*31)
103 #define PPC_LINUX_PT_FPSCR (PPC_LINUX_PT_FPR0 + 2*32 + 1)
105 static int ppc_linux_at_sigtramp_return_path (CORE_ADDR pc
);
107 /* Determine if pc is in a signal trampoline...
109 Ha! That's not what this does at all. wait_for_inferior in
110 infrun.c calls PC_IN_SIGTRAMP in order to detect entry into a
111 signal trampoline just after delivery of a signal. But on
112 GNU/Linux, signal trampolines are used for the return path only.
113 The kernel sets things up so that the signal handler is called
116 If we use in_sigtramp2() in place of in_sigtramp() (see below)
117 we'll (often) end up with stop_pc in the trampoline and prev_pc in
118 the (now exited) handler. The code there will cause a temporary
119 breakpoint to be set on prev_pc which is not very likely to get hit
122 If this is confusing, think of it this way... the code in
123 wait_for_inferior() needs to be able to detect entry into a signal
124 trampoline just after a signal is delivered, not after the handler
127 So, we define in_sigtramp() below to return 1 if the following is
130 1) The previous frame is a real signal trampoline.
134 2) pc is at the first or second instruction of the corresponding
137 Why the second instruction? It seems that wait_for_inferior()
138 never sees the first instruction when single stepping. When a
139 signal is delivered while stepping, the next instruction that
140 would've been stepped over isn't, instead a signal is delivered and
141 the first instruction of the handler is stepped over instead. That
142 puts us on the second instruction. (I added the test for the
143 first instruction long after the fact, just in case the observed
144 behavior is ever fixed.)
146 PC_IN_SIGTRAMP is called from blockframe.c as well in order to set
147 the frame's type (if a SIGTRAMP_FRAME). Because of our strange
148 definition of in_sigtramp below, we can't rely on the frame's type
149 getting set correctly from within blockframe.c. This is why we
150 take pains to set it in init_extra_frame_info().
152 NOTE: cagney/2002-11-10: I suspect the real problem here is that
153 the get_prev_frame() only initializes the frame's type after the
154 call to INIT_FRAME_INFO. get_prev_frame() should be fixed, this
155 code shouldn't be working its way around a bug :-(. */
158 ppc_linux_in_sigtramp (CORE_ADDR pc
, char *func_name
)
166 lr
= read_register (gdbarch_tdep (current_gdbarch
)->ppc_lr_regnum
);
167 if (!ppc_linux_at_sigtramp_return_path (lr
))
170 sp
= read_register (SP_REGNUM
);
172 if (target_read_memory (sp
, buf
, sizeof (buf
)) != 0)
175 tramp_sp
= extract_unsigned_integer (buf
, 4);
177 if (target_read_memory (tramp_sp
+ PPC_LINUX_HANDLER_PTR_OFFSET
, buf
,
181 handler
= extract_unsigned_integer (buf
, 4);
183 return (pc
== handler
|| pc
== handler
+ 4);
187 * The signal handler trampoline is on the stack and consists of exactly
188 * two instructions. The easiest and most accurate way of determining
189 * whether the pc is in one of these trampolines is by inspecting the
190 * instructions. It'd be faster though if we could find a way to do this
191 * via some simple address comparisons.
194 ppc_linux_at_sigtramp_return_path (CORE_ADDR pc
)
197 unsigned long pcinsn
;
198 if (target_read_memory (pc
- 4, buf
, sizeof (buf
)) != 0)
201 /* extract the instruction at the pc */
202 pcinsn
= extract_unsigned_integer (buf
+ 4, 4);
205 (pcinsn
== INSTR_LI_R0_0x7777
206 && extract_unsigned_integer (buf
+ 8, 4) == INSTR_SC
)
209 && extract_unsigned_integer (buf
, 4) == INSTR_LI_R0_0x7777
));
213 ppc_linux_skip_trampoline_code (CORE_ADDR pc
)
216 struct obj_section
*sect
;
217 struct objfile
*objfile
;
219 CORE_ADDR plt_start
= 0;
220 CORE_ADDR symtab
= 0;
221 CORE_ADDR strtab
= 0;
223 int reloc_index
= -1;
229 struct minimal_symbol
*msymbol
;
231 /* Find the section pc is in; return if not in .plt */
232 sect
= find_pc_section (pc
);
233 if (!sect
|| strcmp (sect
->the_bfd_section
->name
, ".plt") != 0)
236 objfile
= sect
->objfile
;
238 /* Pick up the instruction at pc. It had better be of the
242 where IDX is an index into the plt_table. */
244 if (target_read_memory (pc
, buf
, 4) != 0)
246 insn
= extract_unsigned_integer (buf
, 4);
248 if ((insn
& 0xffff0000) != 0x39600000 /* li r11, VAL */ )
251 reloc_index
= (insn
<< 16) >> 16;
253 /* Find the objfile that pc is in and obtain the information
254 necessary for finding the symbol name. */
255 for (sect
= objfile
->sections
; sect
< objfile
->sections_end
; ++sect
)
257 const char *secname
= sect
->the_bfd_section
->name
;
258 if (strcmp (secname
, ".plt") == 0)
259 plt_start
= sect
->addr
;
260 else if (strcmp (secname
, ".rela.plt") == 0)
261 num_slots
= ((int) sect
->endaddr
- (int) sect
->addr
) / 12;
262 else if (strcmp (secname
, ".dynsym") == 0)
264 else if (strcmp (secname
, ".dynstr") == 0)
268 /* Make sure we have all the information we need. */
269 if (plt_start
== 0 || num_slots
== -1 || symtab
== 0 || strtab
== 0)
272 /* Compute the value of the plt table */
273 plt_table
= plt_start
+ 72 + 8 * num_slots
;
275 /* Get address of the relocation entry (Elf32_Rela) */
276 if (target_read_memory (plt_table
+ reloc_index
, buf
, 4) != 0)
278 reloc
= extract_address (buf
, 4);
280 sect
= find_pc_section (reloc
);
284 if (strcmp (sect
->the_bfd_section
->name
, ".text") == 0)
287 /* Now get the r_info field which is the relocation type and symbol
289 if (target_read_memory (reloc
+ 4, buf
, 4) != 0)
291 symidx
= extract_unsigned_integer (buf
, 4);
293 /* Shift out the relocation type leaving just the symbol index */
294 /* symidx = ELF32_R_SYM(symidx); */
295 symidx
= symidx
>> 8;
297 /* compute the address of the symbol */
298 sym
= symtab
+ symidx
* 4;
300 /* Fetch the string table index */
301 if (target_read_memory (sym
, buf
, 4) != 0)
303 symidx
= extract_unsigned_integer (buf
, 4);
305 /* Fetch the string; we don't know how long it is. Is it possible
306 that the following will fail because we're trying to fetch too
308 if (target_read_memory (strtab
+ symidx
, symname
, sizeof (symname
)) != 0)
311 /* This might not work right if we have multiple symbols with the
312 same name; the only way to really get it right is to perform
313 the same sort of lookup as the dynamic linker. */
314 msymbol
= lookup_minimal_symbol_text (symname
, NULL
, NULL
);
318 return SYMBOL_VALUE_ADDRESS (msymbol
);
321 /* The rs6000 version of FRAME_SAVED_PC will almost work for us. The
322 signal handler details are different, so we'll handle those here
323 and call the rs6000 version to do the rest. */
325 ppc_linux_frame_saved_pc (struct frame_info
*fi
)
327 if ((get_frame_type (fi
) == SIGTRAMP_FRAME
))
329 CORE_ADDR regs_addr
=
330 read_memory_integer (fi
->frame
+ PPC_LINUX_REGS_PTR_OFFSET
, 4);
331 /* return the NIP in the regs array */
332 return read_memory_integer (regs_addr
+ 4 * PPC_LINUX_PT_NIP
, 4);
334 else if (fi
->next
&& (get_frame_type (fi
->next
) == SIGTRAMP_FRAME
))
336 CORE_ADDR regs_addr
=
337 read_memory_integer (fi
->next
->frame
+ PPC_LINUX_REGS_PTR_OFFSET
, 4);
338 /* return LNK in the regs array */
339 return read_memory_integer (regs_addr
+ 4 * PPC_LINUX_PT_LNK
, 4);
342 return rs6000_frame_saved_pc (fi
);
346 ppc_linux_init_extra_frame_info (int fromleaf
, struct frame_info
*fi
)
348 rs6000_init_extra_frame_info (fromleaf
, fi
);
352 /* We're called from get_prev_frame_info; check to see if
353 this is a signal frame by looking to see if the pc points
354 at trampoline code */
355 if (ppc_linux_at_sigtramp_return_path (fi
->pc
))
356 deprecated_set_frame_type (fi
, SIGTRAMP_FRAME
);
358 /* FIXME: cagney/2002-11-10: Is this double bogus? What
359 happens if the frame has previously been marked as a dummy? */
360 deprecated_set_frame_type (fi
, NORMAL_FRAME
);
365 ppc_linux_frameless_function_invocation (struct frame_info
*fi
)
367 /* We'll find the wrong thing if we let
368 rs6000_frameless_function_invocation () search for a signal trampoline */
369 if (ppc_linux_at_sigtramp_return_path (fi
->pc
))
372 return rs6000_frameless_function_invocation (fi
);
376 ppc_linux_frame_init_saved_regs (struct frame_info
*fi
)
378 if ((get_frame_type (fi
) == SIGTRAMP_FRAME
))
385 frame_saved_regs_zalloc (fi
);
388 read_memory_integer (fi
->frame
+ PPC_LINUX_REGS_PTR_OFFSET
, 4);
389 fi
->saved_regs
[PC_REGNUM
] = regs_addr
+ 4 * PPC_LINUX_PT_NIP
;
390 fi
->saved_regs
[gdbarch_tdep (current_gdbarch
)->ppc_ps_regnum
] =
391 regs_addr
+ 4 * PPC_LINUX_PT_MSR
;
392 fi
->saved_regs
[gdbarch_tdep (current_gdbarch
)->ppc_cr_regnum
] =
393 regs_addr
+ 4 * PPC_LINUX_PT_CCR
;
394 fi
->saved_regs
[gdbarch_tdep (current_gdbarch
)->ppc_lr_regnum
] =
395 regs_addr
+ 4 * PPC_LINUX_PT_LNK
;
396 fi
->saved_regs
[gdbarch_tdep (current_gdbarch
)->ppc_ctr_regnum
] =
397 regs_addr
+ 4 * PPC_LINUX_PT_CTR
;
398 fi
->saved_regs
[gdbarch_tdep (current_gdbarch
)->ppc_xer_regnum
] =
399 regs_addr
+ 4 * PPC_LINUX_PT_XER
;
400 fi
->saved_regs
[gdbarch_tdep (current_gdbarch
)->ppc_mq_regnum
] =
401 regs_addr
+ 4 * PPC_LINUX_PT_MQ
;
402 for (i
= 0; i
< 32; i
++)
403 fi
->saved_regs
[gdbarch_tdep (current_gdbarch
)->ppc_gp0_regnum
+ i
] =
404 regs_addr
+ 4 * PPC_LINUX_PT_R0
+ 4 * i
;
405 for (i
= 0; i
< 32; i
++)
406 fi
->saved_regs
[FP0_REGNUM
+ i
] = regs_addr
+ 4 * PPC_LINUX_PT_FPR0
+ 8 * i
;
409 rs6000_frame_init_saved_regs (fi
);
413 ppc_linux_frame_chain (struct frame_info
*thisframe
)
415 /* Kernel properly constructs the frame chain for the handler */
416 if ((get_frame_type (thisframe
) == SIGTRAMP_FRAME
))
417 return read_memory_integer ((thisframe
)->frame
, 4);
419 return rs6000_frame_chain (thisframe
);
422 /* ppc_linux_memory_remove_breakpoints attempts to remove a breakpoint
423 in much the same fashion as memory_remove_breakpoint in mem-break.c,
424 but is careful not to write back the previous contents if the code
425 in question has changed in between inserting the breakpoint and
428 Here is the problem that we're trying to solve...
430 Once upon a time, before introducing this function to remove
431 breakpoints from the inferior, setting a breakpoint on a shared
432 library function prior to running the program would not work
433 properly. In order to understand the problem, it is first
434 necessary to understand a little bit about dynamic linking on
437 A call to a shared library function is accomplished via a bl
438 (branch-and-link) instruction whose branch target is an entry
439 in the procedure linkage table (PLT). The PLT in the object
440 file is uninitialized. To gdb, prior to running the program, the
441 entries in the PLT are all zeros.
443 Once the program starts running, the shared libraries are loaded
444 and the procedure linkage table is initialized, but the entries in
445 the table are not (necessarily) resolved. Once a function is
446 actually called, the code in the PLT is hit and the function is
447 resolved. In order to better illustrate this, an example is in
448 order; the following example is from the gdb testsuite.
450 We start the program shmain.
452 [kev@arroyo testsuite]$ ../gdb gdb.base/shmain
455 We place two breakpoints, one on shr1 and the other on main.
458 Breakpoint 1 at 0x100409d4
460 Breakpoint 2 at 0x100006a0: file gdb.base/shmain.c, line 44.
462 Examine the instruction (and the immediatly following instruction)
463 upon which the breakpoint was placed. Note that the PLT entry
464 for shr1 contains zeros.
466 (gdb) x/2i 0x100409d4
467 0x100409d4 <shr1>: .long 0x0
468 0x100409d8 <shr1+4>: .long 0x0
473 Starting program: gdb.base/shmain
474 Breakpoint 1 at 0xffaf790: file gdb.base/shr1.c, line 19.
476 Breakpoint 2, main ()
477 at gdb.base/shmain.c:44
480 Examine the PLT again. Note that the loading of the shared
481 library has initialized the PLT to code which loads a constant
482 (which I think is an index into the GOT) into r11 and then
483 branchs a short distance to the code which actually does the
486 (gdb) x/2i 0x100409d4
487 0x100409d4 <shr1>: li r11,4
488 0x100409d8 <shr1+4>: b 0x10040984 <sg+4>
492 Breakpoint 1, shr1 (x=1)
493 at gdb.base/shr1.c:19
496 Now we've hit the breakpoint at shr1. (The breakpoint was
497 reset from the PLT entry to the actual shr1 function after the
498 shared library was loaded.) Note that the PLT entry has been
499 resolved to contain a branch that takes us directly to shr1.
500 (The real one, not the PLT entry.)
502 (gdb) x/2i 0x100409d4
503 0x100409d4 <shr1>: b 0xffaf76c <shr1>
504 0x100409d8 <shr1+4>: b 0x10040984 <sg+4>
506 The thing to note here is that the PLT entry for shr1 has been
509 Now the problem should be obvious. GDB places a breakpoint (a
510 trap instruction) on the zero value of the PLT entry for shr1.
511 Later on, after the shared library had been loaded and the PLT
512 initialized, GDB gets a signal indicating this fact and attempts
513 (as it always does when it stops) to remove all the breakpoints.
515 The breakpoint removal was causing the former contents (a zero
516 word) to be written back to the now initialized PLT entry thus
517 destroying a portion of the initialization that had occurred only a
518 short time ago. When execution continued, the zero word would be
519 executed as an instruction an an illegal instruction trap was
520 generated instead. (0 is not a legal instruction.)
522 The fix for this problem was fairly straightforward. The function
523 memory_remove_breakpoint from mem-break.c was copied to this file,
524 modified slightly, and renamed to ppc_linux_memory_remove_breakpoint.
525 In tm-linux.h, MEMORY_REMOVE_BREAKPOINT is defined to call this new
528 The differences between ppc_linux_memory_remove_breakpoint () and
529 memory_remove_breakpoint () are minor. All that the former does
530 that the latter does not is check to make sure that the breakpoint
531 location actually contains a breakpoint (trap instruction) prior
532 to attempting to write back the old contents. If it does contain
533 a trap instruction, we allow the old contents to be written back.
534 Otherwise, we silently do nothing.
536 The big question is whether memory_remove_breakpoint () should be
537 changed to have the same functionality. The downside is that more
538 traffic is generated for remote targets since we'll have an extra
539 fetch of a memory word each time a breakpoint is removed.
541 For the time being, we'll leave this self-modifying-code-friendly
542 version in ppc-linux-tdep.c, but it ought to be migrated somewhere
543 else in the event that some other platform has similar needs with
544 regard to removing breakpoints in some potentially self modifying
547 ppc_linux_memory_remove_breakpoint (CORE_ADDR addr
, char *contents_cache
)
549 const unsigned char *bp
;
552 char old_contents
[BREAKPOINT_MAX
];
554 /* Determine appropriate breakpoint contents and size for this address. */
555 bp
= BREAKPOINT_FROM_PC (&addr
, &bplen
);
557 error ("Software breakpoints not implemented for this target.");
559 val
= target_read_memory (addr
, old_contents
, bplen
);
561 /* If our breakpoint is no longer at the address, this means that the
562 program modified the code on us, so it is wrong to put back the
564 if (val
== 0 && memcmp (bp
, old_contents
, bplen
) == 0)
565 val
= target_write_memory (addr
, contents_cache
, bplen
);
570 /* Fetch (and possibly build) an appropriate link_map_offsets
571 structure for GNU/Linux PPC targets using the struct offsets
572 defined in link.h (but without actual reference to that file).
574 This makes it possible to access GNU/Linux PPC shared libraries
575 from a GDB that was not built on an GNU/Linux PPC host (for cross
578 struct link_map_offsets
*
579 ppc_linux_svr4_fetch_link_map_offsets (void)
581 static struct link_map_offsets lmo
;
582 static struct link_map_offsets
*lmp
= NULL
;
588 lmo
.r_debug_size
= 8; /* The actual size is 20 bytes, but
589 this is all we need. */
590 lmo
.r_map_offset
= 4;
593 lmo
.link_map_size
= 20; /* The actual size is 560 bytes, but
594 this is all we need. */
595 lmo
.l_addr_offset
= 0;
598 lmo
.l_name_offset
= 4;
601 lmo
.l_next_offset
= 12;
604 lmo
.l_prev_offset
= 16;
618 ELF_GREGSET_SIZE
= (ELF_NGREG
* 4),
619 ELF_FPREGSET_SIZE
= (ELF_NFPREG
* 8)
623 ppc_linux_supply_gregset (char *buf
)
626 struct gdbarch_tdep
*tdep
= gdbarch_tdep (current_gdbarch
);
628 for (regi
= 0; regi
< 32; regi
++)
629 supply_register (regi
, buf
+ 4 * regi
);
631 supply_register (PC_REGNUM
, buf
+ 4 * PPC_LINUX_PT_NIP
);
632 supply_register (tdep
->ppc_lr_regnum
, buf
+ 4 * PPC_LINUX_PT_LNK
);
633 supply_register (tdep
->ppc_cr_regnum
, buf
+ 4 * PPC_LINUX_PT_CCR
);
634 supply_register (tdep
->ppc_xer_regnum
, buf
+ 4 * PPC_LINUX_PT_XER
);
635 supply_register (tdep
->ppc_ctr_regnum
, buf
+ 4 * PPC_LINUX_PT_CTR
);
636 if (tdep
->ppc_mq_regnum
!= -1)
637 supply_register (tdep
->ppc_mq_regnum
, buf
+ 4 * PPC_LINUX_PT_MQ
);
638 supply_register (tdep
->ppc_ps_regnum
, buf
+ 4 * PPC_LINUX_PT_MSR
);
642 ppc_linux_supply_fpregset (char *buf
)
645 struct gdbarch_tdep
*tdep
= gdbarch_tdep (current_gdbarch
);
647 for (regi
= 0; regi
< 32; regi
++)
648 supply_register (FP0_REGNUM
+ regi
, buf
+ 8 * regi
);
650 /* The FPSCR is stored in the low order word of the last doubleword in the
652 supply_register (tdep
->ppc_fpscr_regnum
, buf
+ 8 * 32 + 4);
656 Use a local version of this function to get the correct types for regsets.
660 fetch_core_registers (char *core_reg_sect
,
661 unsigned core_reg_size
,
667 if (core_reg_size
== ELF_GREGSET_SIZE
)
668 ppc_linux_supply_gregset (core_reg_sect
);
670 warning ("wrong size gregset struct in core file");
674 if (core_reg_size
== ELF_FPREGSET_SIZE
)
675 ppc_linux_supply_fpregset (core_reg_sect
);
677 warning ("wrong size fpregset struct in core file");
681 /* Register that we are able to handle ELF file formats using standard
682 procfs "regset" structures. */
684 static struct core_fns ppc_linux_regset_core_fns
=
686 bfd_target_elf_flavour
, /* core_flavour */
687 default_check_format
, /* check_format */
688 default_core_sniffer
, /* core_sniffer */
689 fetch_core_registers
, /* core_read_registers */
694 ppc_linux_init_abi (struct gdbarch_info info
,
695 struct gdbarch
*gdbarch
)
697 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
699 /* Until November 2001, gcc was not complying to the SYSV ABI for
700 returning structures less than or equal to 8 bytes in size. It was
701 returning everything in memory. When this was corrected, it wasn't
702 fixed for native platforms. */
703 set_gdbarch_use_struct_convention (gdbarch
,
704 ppc_sysv_abi_broken_use_struct_convention
);
706 if (tdep
->wordsize
== 4)
708 /* Note: kevinb/2002-04-12: See note in rs6000_gdbarch_init regarding
709 *_push_arguments(). The same remarks hold for the methods below. */
710 set_gdbarch_frameless_function_invocation (gdbarch
,
711 ppc_linux_frameless_function_invocation
);
712 set_gdbarch_frame_chain (gdbarch
, ppc_linux_frame_chain
);
713 set_gdbarch_frame_saved_pc (gdbarch
, ppc_linux_frame_saved_pc
);
715 set_gdbarch_frame_init_saved_regs (gdbarch
,
716 ppc_linux_frame_init_saved_regs
);
717 set_gdbarch_init_extra_frame_info (gdbarch
,
718 ppc_linux_init_extra_frame_info
);
720 set_gdbarch_memory_remove_breakpoint (gdbarch
,
721 ppc_linux_memory_remove_breakpoint
);
722 set_solib_svr4_fetch_link_map_offsets
723 (gdbarch
, ppc_linux_svr4_fetch_link_map_offsets
);
728 _initialize_ppc_linux_tdep (void)
730 gdbarch_register_osabi (bfd_arch_powerpc
, 0, GDB_OSABI_LINUX
,
732 add_core_fns (&ppc_linux_regset_core_fns
);