This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: RFA: AIX 64-bit mega-patch


On 13-Jun-2000, Kevin Buettner wrote:

>I would like us to use generic dummy frames for both cases.

That turned out to be the best way to fix some 4.1 problems.  The appended
patch does that, fixes a few other 4.1 goofs, and addresses a few of David
Edelsohn's nomenclature concerns.

As I mentioned in the "RFA: bfd/rs6000-core.c 64-bit support" thread,
there are no 4.3 regressions and three 4.1 GDB regressions, which I'll fix
in a follow-on BFD patch.

I'll merge this patch into the original before committing.

Nick

2000-06-16  Nicholas Duffek  <nsd@redhat.com>

	* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
	support.  Incorporate most of tm-rs6000.h.
	(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
	(rs6000_set_host_arch_hook): Declare.
	(read_memory_addr): Define.
	(pop_frame): Rename to rs6000_pop_frame.
	(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
	rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
	dummy frame handling.
	(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
	rs6000_frame_saved_pc, frame_get_saved_regs,
	frame_initial_stack_address, rs6000_frame_chain,
	rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
	of read_memory_integer.
	(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
	rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
	frame_get_saved_regs, frame_initial_stack_address,
	rs6000_frame_chain): Replace 4 with TDEP->wordsize.
	(skip_prologue): Recognize some 64-bit stack adjustments.
	(push_dummy_frame, pop_dummy_frame, set_processor,
	show_processor): Delete.
	(frame_get_saved_regs): Manipulate saved register addresses using
	CORE_ADDR instead of int.
	(rs6000_create_inferior): New function.
	(register_names_*[]): Change to struct reg registers_*[].
	(variants[]): Assimilate into multi-arch approach.
	(register_names_*[], variants[]): Refer to pre-PowerPC
	architectures as POWER instead of RS6000.
	* rs6000-nat.c: Ubiquitous changes for 64-bit support.
	(vmap_secs, xcoff_relocate_symtab): Cast addresses
	to unsigned long to avoid sign-extension errors.
	(set_host_arch): New function.
	(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
	(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
	(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
	* symfile.c (find_sym_fns): Remove special xcoff kludge.
	* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
	(process_linenos): Query line struct size from coff
	backend instead of using compile-time constant.
	(enter_line_range): Likewise.
	(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
	record_debugformat() if appropriate.
	(process_xcoff_symbol): Access symbol addresses using
	SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
	(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
	(scan_xcoff_symtab): Likewise.  Query syment struct size from
	coff backend instead of using compile-time constant.
	(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
	* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
	that this Makefile variable get set to.  (From Kevin Buettner.)
	* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
	the TOC doesn't overflow.  (From Kevin Buettner.)
	* config/powerpc/tm-ppc-aix.h: Move config decisions to
	multi-arched rs6000-tdep.c.
	* config/rs6000/tm-rs6000.h: Likewise.
	(GDB_MULTI_ARCH): Define.
	(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
	(is_magic_function_pointer): Replace with
	rs6000_convert_from_func_ptr_addr.
	(TARGET_CREATE_INFERIOR_HOOK): Define.
	(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
	(rs6000_set_host_arch_hook): Declare.
	* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.

Index: gdb/rs6000-nat.c
===================================================================
diff -up gdb/rs6000-nat.c gdb/rs6000-nat.c
--- gdb/rs6000-nat.c	Fri Jun 16 11:33:56 2000
+++ gdb/rs6000-nat.c	Thu Jun 15 20:30:22 2000
@@ -107,7 +107,7 @@ typedef union {
    32-bit and 64-bit versions of ld_info. */
 
 #ifndef ARCH3264
-# define LDI_FIELD(ldi, arch64, field) (ldi)->ldinfo_##field
+# define LDI_FIELD(ldi, arch64, field) (ldi)->l32.ldinfo_##field
 #else
 # define LDI_FIELD(ldi, arch64, field) \
   (arch64 ? (ldi)->l64.ldinfo_##field : (ldi)->l32.ldinfo_##field)
@@ -172,7 +172,11 @@ ptrace32 (int req, int id, int *addr, in
 static int
 ptrace64 (int req, int id, long long addr, int data, int *buf)
 {
+#ifdef ARCH3264
   int ret = ptracex (req, id, addr, data, buf);
+#else
+  int ret = 0;
+#endif
 #if 0
   printf ("ptrace64 (%d, %d, 0x%llx, %08x, 0x%x) = 0x%x\n",
 	  req, id, addr, data, (unsigned int)buf, ret);
@@ -562,9 +566,9 @@ vmap_secs (struct vmap *vp, LdInfo *ldi,
 {
   if (arch64)
     {
-      vp->tstart = ldi->l64.ldinfo_textorg;
+      vp->tstart = (CORE_ADDR) ldi->l64.ldinfo_textorg;
       vp->tend = vp->tstart + ldi->l64.ldinfo_textsize;
-      vp->dstart = ldi->l64.ldinfo_dataorg;
+      vp->dstart = (CORE_ADDR) ldi->l64.ldinfo_dataorg;
       vp->dend = vp->dstart + ldi->l64.ldinfo_datasize;
     }
   else
@@ -729,7 +733,7 @@ vmap_ldinfo (LdInfo *ldi)
   int got_one, retried;
   int got_exec_file = 0;
   uint next;
-  ARCH64_DECL (arch64);
+  int arch64 = ARCH64 ();
 
   /* For each *ldi, see if we have a corresponding *vp.
      If so, update the mapping, and symbol table.
Index: gdb/rs6000-tdep.c
===================================================================
diff -up gdb/rs6000-tdep.c gdb/rs6000-tdep.c
--- gdb/rs6000-tdep.c	Fri Jun 16 11:34:07 2000
+++ gdb/rs6000-tdep.c	Thu Jun 15 12:07:16 2000
@@ -129,53 +129,8 @@ static CORE_ADDR branch_dest (int opcode
 static CORE_ADDR skip_prologue (CORE_ADDR, struct rs6000_framedata *);
 static void frame_get_saved_regs (struct frame_info * fi,
 				  struct rs6000_framedata * fdatap);
-static void rs6000_pop_dummy_frame (void);
 static CORE_ADDR frame_initial_stack_address (struct frame_info *);
 
-/* Call dummy instruction sequence:
-
-   mflr r0              // 0x7c0802a6
-   // save fpr's
-   stfd r?, num(r1)     // 0xd8010000 there should be 32 of this??
-   // save gpr's
-   stm  r0, num(r1)     // 0xbc010000
-   stu  r1, num(r1)     // 0x94210000
-
-   // the function we want to branch might be in a different load 
-   // segment. reset the toc register. Note that the actual toc address
-   // will be fix by fix_call_dummy () along with function address.
-
-   st   r2, 0x14(r1)    // 0x90410014 save toc register
-   liu  r2, 0x1234      // 0x3c401234 reset a new toc value 0x12345678
-   oril r2, r2,0x5678   // 0x60425678   
-
-   // load absolute address 0x12345678 to r0
-   liu  r0, 0x1234      // 0x3c001234
-   oril r0, r0,0x5678   // 0x60005678
-   mtctr        r0              // 0x7c0903a6 ctr <- r0
-   bctrl                        // 0x4e800421 jump subroutine 0x12345678 (%ctr)
-   cror 0xf, 0xf, 0xf   // 0x4def7b82
-   brpt                 // 0x7d821008, breakpoint
-   cror 0xf, 0xf, 0xf   // 0x4def7b82 (for 8 byte alignment)
-
-   We actually start executing by saving the toc register first, since the pushing 
-   of the registers is done by PUSH_DUMMY_FRAME.  If this were real code,
-   the arguments for the function called by the `bctrl' would be pushed
-   between the `stu' and the `bctrl', and we could allow it to execute through.
-   But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is done,
-   and we cannot allow to push the registers again.
-
-   Keep this as multiple of 8 (%sp requires 8 byte alignment).
- */
-
-static LONGEST rs6000_call_dummy_words[] =
-{
-  0x7c0802a6, 0xd8010000, 0xbc010000, 0x94210000,
-  0x90410014, 0x3c401234, 0x60425678,
-  0x3c001234, 0x60005678, 0x7c0903a6, 0x4e800421,
-  0x4def7b82, 0x7d821008, 0x4def7b82
-};
-
 /* Read a LEN-byte address from debugged memory address MEMADDR. */
 
 static CORE_ADDR
@@ -226,7 +181,7 @@ rs6000_init_extra_frame_info (int fromle
    ways in the stack frame.  sp is even more special:
    the address we return for it IS the sp for the next frame.  */
 
-/* In this implementation for RS6000, we do *not* save sp. I am
+/* In this implementation for RS/6000, we do *not* save sp. I am
    not sure if it will be needed. The following function takes care of gpr's
    and fpr's only. */
 
@@ -724,194 +679,8 @@ skip_prologue (CORE_ADDR pc, struct rs60
   frames, etc. 
 *************************************************************************/
 
-/* Much of the following is only needed for POWER, not PowerPC, so
-   there's no need to make it 64-bit safe. */
-
-/* POWER (32-bit) only: The total size of dummy frame is 436, which is;
-
-   32 gpr's           - 128 bytes
-   32 fpr's           - 256 bytes
-   7  the rest        -  28 bytes
-   callee's link area -  24 bytes
-   padding            -  12 bytes
-
-   Note that the last 24 bytes for the link area might not be necessary,
-   since it will be taken care of by push_arguments(). */
-
-#define DUMMY_FRAME_SIZE 448
-
-#define	DUMMY_FRAME_ADDR_SIZE 10
-
-static int dummy_frame_count = 0;
-static int dummy_frame_size = 0;
-static CORE_ADDR *dummy_frame_addr = 0;
-
 extern int stop_stack_dummy;
 
-/* Initialize dummy frame storage.  POWER (32-bit) only. */
-
-static void
-dummy_init (void)
-{
-  if (!dummy_frame_addr)
-    return;
-  free (dummy_frame_addr);
-  dummy_frame_addr = NULL;
-  dummy_frame_count = 0;
-  dummy_frame_size = 0;
-}
-
-/* Push a dummy frame into stack, saving all registers.
-   POWER (32-bit) only. */
-
-static void
-rs6000_push_dummy_frame (void)
-{
-  /* stack pointer.  */
-  CORE_ADDR sp;
-  /* Same thing, target byte order.  */
-  char sp_targ[4];
-
-  /* link register.  */
-  CORE_ADDR pc;
-  /* Same thing, target byte order.  */
-  char pc_targ[4];
-
-  /* Needed to figure out where to save the dummy link area.
-     FIXME: There should be an easier way to do this, no?  tiemann 9/9/95.  */
-  struct rs6000_framedata fdata;
-
-  int ii;
-
-  target_fetch_registers (-1);
-
-  if (dummy_frame_count >= dummy_frame_size)
-    {
-      dummy_frame_size += DUMMY_FRAME_ADDR_SIZE;
-      if (dummy_frame_addr)
-	dummy_frame_addr = (CORE_ADDR *) xrealloc
-	  (dummy_frame_addr, sizeof (CORE_ADDR) * (dummy_frame_size));
-      else
-	dummy_frame_addr = (CORE_ADDR *)
-	  xmalloc (sizeof (CORE_ADDR) * (dummy_frame_size));
-    }
-
-  sp = read_register (SP_REGNUM);
-  pc = read_register (PC_REGNUM);
-  store_address (pc_targ, 4, pc);
-
-  skip_prologue (get_pc_function_start (pc), &fdata);
-
-  dummy_frame_addr[dummy_frame_count++] = sp;
-
-  /* Be careful! If the stack pointer is not decremented first, then kernel 
-     thinks he is free to use the space underneath it. And kernel actually 
-     uses that area for IPC purposes when executing ptrace(2) calls. So 
-     before writing register values into the new frame, decrement and update
-     %sp first in order to secure your frame. */
-
-  /* FIXME: We don't check if the stack really has this much space.
-     This is a problem on the ppc simulator (which only grants one page
-     (4096 bytes) by default.  */
-
-  write_register (SP_REGNUM, sp - DUMMY_FRAME_SIZE);
-
-  /* gdb relies on the state of current_frame. We'd better update it,
-     otherwise things like do_registers_info() wouldn't work properly! */
-
-  flush_cached_frames ();
-
-  /* save program counter in link register's space. */
-  write_memory (sp + (fdata.lr_offset ? fdata.lr_offset : DEFAULT_LR_SAVE),
-		pc_targ, 4);
-
-  /* save all floating point and general purpose registers here. */
-
-  /* fpr's, f0..f31 */
-  for (ii = 0; ii < 32; ++ii)
-    write_memory (sp - 8 - (ii * 8), &registers[REGISTER_BYTE (31 - ii + FP0_REGNUM)], 8);
-
-  /* gpr's r0..r31 */
-  for (ii = 1; ii <= 32; ++ii)
-    write_memory (sp - 256 - (ii * 4), &registers[REGISTER_BYTE (32 - ii)], 4);
-
-  /* so far, 32*2 + 32 words = 384 bytes have been written. 
-     7 extra registers in our register set: pc, ps, cnd, lr, cnt, xer, mq */
-
-  for (ii = 1; ii <= (LAST_UISA_SP_REGNUM - FIRST_UISA_SP_REGNUM + 1); ++ii)
-    {
-      write_memory (sp - 384 - (ii * 4),
-		    &registers[REGISTER_BYTE (FPLAST_REGNUM + ii)], 4);
-    }
-
-  /* Save sp or so called back chain right here. */
-  store_address (sp_targ, 4, sp);
-  write_memory (sp - DUMMY_FRAME_SIZE, sp_targ, 4);
-  sp -= DUMMY_FRAME_SIZE;
-
-  /* And finally, this is the back chain. */
-  write_memory (sp + 8, pc_targ, 4);
-}
-
-
-/* Pop a dummy frame.  POWER (32-bit) only.
-
-   In rs6000 when we push a dummy frame, we save all of the registers. This
-   is usually done before user calls a function explicitly.
-
-   After a dummy frame is pushed, some instructions are copied into stack,
-   and stack pointer is decremented even more.  Since we don't have a frame
-   pointer to get back to the parent frame of the dummy, we start having
-   trouble poping it.  Therefore, we keep a dummy frame stack, keeping
-   addresses of dummy frames as such.  When poping happens and when we
-   detect that was a dummy frame, we pop it back to its parent by using
-   dummy frame stack (`dummy_frame_addr' array). 
-
-   FIXME:  This whole concept is broken.  You should be able to detect
-   a dummy stack frame *on the user's stack itself*.  When you do,
-   then you know the format of that stack frame -- including its
-   saved SP register!  There should *not* be a separate stack in the
-   GDB process that keeps track of these dummy frames!  -- gnu@cygnus.com Aug92
- */
-
-static void
-rs6000_pop_dummy_frame (void)
-{
-  CORE_ADDR sp, pc;
-  int ii;
-  sp = dummy_frame_addr[--dummy_frame_count];
-
-  /* restore all fpr's. */
-  for (ii = 1; ii <= 32; ++ii)
-    read_memory (sp - (ii * 8), &registers[REGISTER_BYTE (32 - ii + FP0_REGNUM)], 8);
-
-  /* restore all gpr's */
-  for (ii = 1; ii <= 32; ++ii)
-    {
-      read_memory (sp - 256 - (ii * 4), &registers[REGISTER_BYTE (32 - ii)], 4);
-    }
-
-  /* restore the rest of the registers. */
-  for (ii = 1; ii <= (LAST_UISA_SP_REGNUM - FIRST_UISA_SP_REGNUM + 1); ++ii)
-    read_memory (sp - 384 - (ii * 4),
-		 &registers[REGISTER_BYTE (FPLAST_REGNUM + ii)], 4);
-
-  read_memory (sp - (DUMMY_FRAME_SIZE - 8),
-	       &registers[REGISTER_BYTE (PC_REGNUM)], 4);
-
-  /* when a dummy frame was being pushed, we had to decrement %sp first, in 
-     order to secure astack space. Thus, saved %sp (or %r1) value, is not the
-     one we should restore. Change it with the one we need. */
-
-  memcpy (&registers[REGISTER_BYTE (FP_REGNUM)], (char *) &sp, sizeof (int));
-
-  /* Now we can restore all registers. */
-
-  target_store_registers (-1);
-  pc = read_pc ();
-  flush_cached_frames ();
-}
-
 
 /* Pop the innermost frame, go back to the caller. */
 
@@ -928,19 +697,9 @@ rs6000_pop_frame (void)
 
   if (stop_stack_dummy)
     {
-      if (USE_GENERIC_DUMMY_FRAMES)
-	{
-	  generic_pop_dummy_frame ();
-	  flush_cached_frames ();
-	  return;
-	}
-      else
-	{
-	  /* POWER (32-bit) only. */
-	  if (dummy_frame_count)
-	    rs6000_pop_dummy_frame ();
-	  return;
-	}
+      generic_pop_dummy_frame ();
+      flush_cached_frames ();
+      return;
     }
 
   /* Make sure that all registers are valid.  */
@@ -1007,42 +766,14 @@ rs6000_fix_call_dummy (char *dummyname, 
   int ii;
   CORE_ADDR target_addr;
 
-  if (USE_GENERIC_DUMMY_FRAMES)
+  if (rs6000_find_toc_address_hook != NULL)
     {
-      if (rs6000_find_toc_address_hook != NULL)
-	{
-	  CORE_ADDR tocvalue = (*rs6000_find_toc_address_hook) (fun);
-	  write_register (TOC_REGNUM, tocvalue);
-	}
-    }
-  else
-    {
-      if (rs6000_find_toc_address_hook != NULL)
-	{
-	  CORE_ADDR tocvalue;
-
-	  tocvalue = (*rs6000_find_toc_address_hook) (fun);
-	  ii = *(int *) ((char *) dummyname + TOC_ADDR_OFFSET);
-	  ii = (ii & 0xffff0000) | (tocvalue >> 16);
-	  *(int *) ((char *) dummyname + TOC_ADDR_OFFSET) = ii;
-
-	  ii = *(int *) ((char *) dummyname + TOC_ADDR_OFFSET + 4);
-	  ii = (ii & 0xffff0000) | (tocvalue & 0x0000ffff);
-	  *(int *) ((char *) dummyname + TOC_ADDR_OFFSET + 4) = ii;
-	}
-
-      target_addr = fun;
-      ii = *(int *) ((char *) dummyname + TARGET_ADDR_OFFSET);
-      ii = (ii & 0xffff0000) | (target_addr >> 16);
-      *(int *) ((char *) dummyname + TARGET_ADDR_OFFSET) = ii;
-
-      ii = *(int *) ((char *) dummyname + TARGET_ADDR_OFFSET + 4);
-      ii = (ii & 0xffff0000) | (target_addr & 0x0000ffff);
-      *(int *) ((char *) dummyname + TARGET_ADDR_OFFSET + 4) = ii;
+      CORE_ADDR tocvalue = (*rs6000_find_toc_address_hook) (fun);
+      write_register (TOC_REGNUM, tocvalue);
     }
 }
 
-/* Pass the arguments in either registers, or in the stack. In RS6000,
+/* Pass the arguments in either registers, or in the stack. In RS/6000,
    the first eight words of the argument list (that might be less than
    eight parameters if some parameters occupy more than one word) are
    passed in r3..r10 registers.  float and double parameters are
@@ -1075,12 +806,6 @@ rs6000_push_arguments (int nargs, value_
 
   CORE_ADDR saved_sp;
 
-  if (!USE_GENERIC_DUMMY_FRAMES)
-    {
-      if (dummy_frame_count <= 0)
-	printf_unfiltered ("FATAL ERROR -push_arguments()! frame not found!!\n");
-    }
-
   /* The first eight words of ther arguments are passed in registers. Copy
      them appropriately.
 
@@ -1166,33 +891,17 @@ rs6000_push_arguments (int nargs, value_
 
 ran_out_of_registers_for_arguments:
 
-  if (USE_GENERIC_DUMMY_FRAMES)
-    {
-      saved_sp = read_sp ();
+  saved_sp = read_sp ();
 #ifndef ELF_OBJECT_FORMAT
-      /* location for 8 parameters are always reserved. */
-      sp -= wordsize * 8;
+  /* location for 8 parameters are always reserved. */
+  sp -= wordsize * 8;
 
-      /* another six words for back chain, TOC register, link register, etc. */
-      sp -= wordsize * 6;
+  /* another six words for back chain, TOC register, link register, etc. */
+  sp -= wordsize * 6;
 
-      /* stack pointer must be quadword aligned */
-      sp &= -16;
+  /* stack pointer must be quadword aligned */
+  sp &= -16;
 #endif
-    }
-  else
-    {
-      /* POWER (32-bit) only. */
-
-      /* location for 8 parameters are always reserved. */
-      sp -= 4 * 8;
-
-      /* another six words for back chain, TOC register, link register, etc. */
-      sp -= 24;
-
-      /* stack pointer must be quadword aligned */
-      sp &= -16;
-    }
 
   /* if there are more arguments, allocate space for them in 
      the stack, then push them starting from the ninth one. */
@@ -1269,16 +978,6 @@ ran_out_of_registers_for_arguments:
     /* Secure stack areas first, before doing anything else. */
     write_register (SP_REGNUM, sp);
 
-  if (!USE_GENERIC_DUMMY_FRAMES)
-    {
-      /* POWER (32-bit) only.  We want to copy 24 bytes of target's frame to
-         dummy's frame, then set back chain to point to new frame. */
-
-      saved_sp = dummy_frame_addr[dummy_frame_count - 1];
-      read_memory (saved_sp, tmp_buffer, 24);
-      write_memory (sp, tmp_buffer, 24);
-    }
-
   /* set back chain properly */
   store_address (tmp_buffer, 4, saved_sp);
   write_memory (sp, tmp_buffer, 4);
@@ -1433,11 +1132,8 @@ rs6000_frame_saved_pc (struct frame_info
   if (fi->signal_handler_caller)
     return read_memory_addr (fi->frame + SIG_FRAME_PC_OFFSET, wordsize);
 
-  if (USE_GENERIC_DUMMY_FRAMES)
-    {
-      if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
-	return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
-    }
+  if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+    return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
 
   func_start = get_pc_function_start (fi->pc);
 
@@ -1617,20 +1313,17 @@ frame_initial_stack_address (struct fram
 /* FRAME_CHAIN takes a frame's nominal address
    and produces the frame's chain-pointer. */
 
-/* In the case of the RS6000, the frame's nominal address
+/* In the case of the RS/6000, the frame's nominal address
    is the address of a 4-byte word containing the calling frame's address.  */
 
 static CORE_ADDR
 rs6000_frame_chain (struct frame_info *thisframe)
 {
-  CORE_ADDR fp;
+  CORE_ADDR fp, fpp, lr;
   int wordsize = TDEP->wordsize;
 
-  if (USE_GENERIC_DUMMY_FRAMES)
-    {
-      if (PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame))
-	return thisframe->frame;	/* dummy frame same as caller's frame */
-    }
+  if (PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame))
+    return thisframe->frame;	/* dummy frame same as caller's frame */
 
   if (inside_entry_file (thisframe->pc) ||
       thisframe->pc == entry_point_address ())
@@ -1648,16 +1341,11 @@ rs6000_frame_chain (struct frame_info *t
   else
     fp = read_memory_addr ((thisframe)->frame, wordsize);
 
-  if (USE_GENERIC_DUMMY_FRAMES)
-    {
-      CORE_ADDR fpp, lr;
-
-      lr = read_register (LR_REGNUM);
-      if (lr == entry_point_address ())
-	if (fp != 0 && (fpp = read_memory_addr (fp, wordsize)) != 0)
-	  if (PC_IN_CALL_DUMMY (lr, fpp, fpp))
-	    return fpp;
-    }
+  lr = read_register (LR_REGNUM);
+  if (lr == entry_point_address ())
+    if (fp != 0 && (fpp = read_memory_addr (fp, wordsize)) != 0)
+      if (PC_IN_CALL_DUMMY (lr, fpp, fpp))
+	return fpp;
 
   return fp;
 }
@@ -1742,7 +1430,7 @@ rs6000_coerce_float_to_double (struct ty
 /* Return whether register N requires conversion when moving from raw format
    to virtual format.
 
-   The register format for rs6000 floating point registers is always
+   The register format for RS/6000 floating point registers is always
    double, we need a conversion if the memory format is float. */
 
 static int
@@ -1787,7 +1475,7 @@ rs6000_register_convert_to_raw (struct t
 /* Store the address of the place in which to copy the structure the
    subroutine will return.  This is called from call_function.
 
-   In RS6000, struct return addresses are passed as an extra parameter in r3.
+   In RS/6000, struct return addresses are passed as an extra parameter in r3.
    In function return, callee is not responsible of returning this address
    back.  Since gdb needs to find it, we will store in a designated variable
    `rs6000_struct_return_address'. */
@@ -1847,7 +1535,6 @@ rs6000_create_inferior (int pid)
 {
   if (rs6000_set_host_arch_hook)
     rs6000_set_host_arch_hook (pid);
-  dummy_init ();
 }
 
 /* Support for CONVERT_FROM_FUNC_PTR_ADDR(ADDR).
@@ -1883,7 +1570,7 @@ rs6000_convert_from_func_ptr_addr (CORE_
 }
 
 
-/* Handling the various PowerPC/RS6000 variants.  */
+/* Handling the various POWER/PowerPC variants.  */
 
 
 /* The arrays here called registers_MUMBLE hold information about available
@@ -1974,9 +1661,9 @@ rs6000_convert_from_func_ptr_addr (CORE_
   /* 112 */ R(srr0),   R(srr1),   R(tbl),    R(tbu),    \
   /* 116 */ R4(dec),   R(dabr),   R4(ear)
 
-/* IBM RS6000 ("POWER") architecture, user-level view.  For the RS6000, we
-   only cover user-level SPR's. */
-static const struct reg registers_rs6000[] =
+/* IBM POWER (pre-PowerPC) architecture, user-level view.  We only cover
+   user-level SPR's. */
+static const struct reg registers_power[] =
 {
   COMMON_UISA_REGS,
   /* 66 */ R4(cnd), R(lr), R(cnt), R4(xer), R4(mq)
@@ -1984,7 +1671,7 @@ static const struct reg registers_rs6000
 
 /* PowerPC UISA - a PPC processor as viewed by user-level code.  A UISA-only
    view of the PowerPC. */
-static const struct reg registers_uisa[] =
+static const struct reg registers_powerpc[] =
 {
   COMMON_UISA_REGS,
   PPC_UISA_SPRS
@@ -2155,10 +1842,10 @@ struct variant
 
 static const struct variant variants[] =
 {
-  {"ppc-uisa", "PowerPC user-level", bfd_arch_powerpc,
-   bfd_mach_ppc, num_registers (registers_uisa), registers_uisa},
-  {"rs6000", "IBM RS6000 user-level", bfd_arch_rs6000,
-   bfd_mach_rs6k, num_registers (registers_rs6000), registers_rs6000},
+  {"powerpc", "PowerPC user-level", bfd_arch_powerpc,
+   bfd_mach_ppc, num_registers (registers_powerpc), registers_powerpc},
+  {"power", "POWER user-level", bfd_arch_rs6000,
+   bfd_mach_rs6k, num_registers (registers_power), registers_power},
   {"403", "IBM PowerPC 403", bfd_arch_powerpc,
    bfd_mach_ppc_403, num_registers (registers_403), registers_403},
   {"601", "Motorola PowerPC 601", bfd_arch_powerpc,
@@ -2180,15 +1867,15 @@ static const struct variant variants[] =
 
   /* FIXME: I haven't checked the register sets of the following. */
   {"620", "Motorola PowerPC 620", bfd_arch_powerpc,
-   bfd_mach_ppc_620, num_registers (registers_uisa), registers_uisa},
+   bfd_mach_ppc_620, num_registers (registers_powerpc), registers_powerpc},
   {"a35", "PowerPC A35", bfd_arch_powerpc,
-   bfd_mach_ppc_a35, num_registers (registers_uisa), registers_uisa},
-  {"rs1", "IBM RS6000 RS1", bfd_arch_rs6000,
-   bfd_mach_rs6k_rs1, num_registers (registers_rs6000), registers_rs6000},
-  {"rsc", "IBM RS6000 RSC", bfd_arch_rs6000,
-   bfd_mach_rs6k_rsc, num_registers (registers_rs6000), registers_rs6000},
-  {"rs2", "IBM RS6000 RS2", bfd_arch_rs6000,
-   bfd_mach_rs6k_rs2, num_registers (registers_rs6000), registers_rs6000},
+   bfd_mach_ppc_a35, num_registers (registers_powerpc), registers_powerpc},
+  {"rs1", "IBM POWER RS1", bfd_arch_rs6000,
+   bfd_mach_rs6k_rs1, num_registers (registers_power), registers_power},
+  {"rsc", "IBM POWER RSC", bfd_arch_rs6000,
+   bfd_mach_rs6k_rsc, num_registers (registers_power), registers_power},
+  {"rs2", "IBM POWER RS2", bfd_arch_rs6000,
+   bfd_mach_rs6k_rs2, num_registers (registers_power), registers_power},
 
   {0, 0, 0, 0}
 };
@@ -2239,7 +1926,7 @@ rs6000_gdbarch_init (struct gdbarch_info
 {
   struct gdbarch *gdbarch;
   struct gdbarch_tdep *tdep;
-  int wordsize, fromexec, rs6000, i, off;
+  int wordsize, fromexec, power, i, off;
   struct reg *regs;
   const struct variant *v;
   enum bfd_architecture arch;
@@ -2303,17 +1990,17 @@ rs6000_gdbarch_init (struct gdbarch_info
   tdep = xmalloc (sizeof (struct gdbarch_tdep));
   tdep->wordsize = wordsize;
   gdbarch = gdbarch_alloc (&info, tdep);
-  rs6000 = arch == bfd_arch_rs6000;
+  power = arch == bfd_arch_rs6000;
 
   /* Select instruction printer. */
-  tm_print_insn = arch == rs6000 ? print_insn_rs6000 :
+  tm_print_insn = arch == power ? print_insn_rs6000 :
     info.byte_order == BIG_ENDIAN ? print_insn_big_powerpc :
       print_insn_little_powerpc;
 
   /* Choose variant. */
   v = find_variant_by_arch (arch, mach);
   if (!v)
-    v = find_variant_by_name (rs6000 ? "rs6000" : "ppc-uisa");
+    v = find_variant_by_name (power ? "power" : "powerpc");
   tdep->regs = v->regs;
 
   /* Calculate byte offsets in raw register array. */
@@ -2354,35 +2041,20 @@ rs6000_gdbarch_init (struct gdbarch_info
   set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
   set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
 
-  if (rs6000)
-    {
-      set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
-      set_gdbarch_push_dummy_frame (gdbarch, rs6000_push_dummy_frame);
-      set_gdbarch_get_saved_register (gdbarch, default_get_saved_register);
-      set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 0);
-      set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
-      set_gdbarch_call_dummy_start_offset (gdbarch, 16);
-    }
-  else
-    {
-      set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
-      set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
-      set_gdbarch_push_return_address (gdbarch, ppc_push_return_address);
-      set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
-      set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
-      set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
-      set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
-      set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
-      set_gdbarch_call_dummy_start_offset (gdbarch, 0);
-    }
-  set_gdbarch_call_dummy_length (gdbarch, sizeof (rs6000_call_dummy_words) /
-				 sizeof (LONGEST) * 4);
+  set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
+  set_gdbarch_call_dummy_length (gdbarch, 0);
+  set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
+  set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
+  set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
+  set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
+  set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_pc_in_call_dummy (gdbarch, rs6000_pc_in_call_dummy);
-  set_gdbarch_call_dummy_words (gdbarch, rs6000_call_dummy_words);
-  set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (rs6000_call_dummy_words));
   set_gdbarch_call_dummy_p (gdbarch, 1);
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
+  set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
   set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy);
+  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
+  set_gdbarch_push_return_address (gdbarch, ppc_push_return_address);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
   set_gdbarch_coerce_float_to_double (gdbarch, rs6000_coerce_float_to_double);
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]