Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [patch/rfc] Add get_*() to rs6000-tdep.c
Date: Tue, 17 Dec 2002 10:35:00 -0000	[thread overview]
Message-ID: <3DFF68FD.6090403@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]

The attatched modifies rs6000-tdep.c so that it uses 
get_frame_extra_info(), get_frame_saved_regs() and 
frame_extra_info_zalloc().

I'll look to commit this in a few days.

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 5920 bytes --]

2002-12-17  Andrew Cagney  <ac131313@redhat.com>

	* rs6000-tdep.c (rs6000_init_extra_frame_info): Use
	frame_extra_info_zalloc.
	(rs6000_frame_args_address): Use get_frame_extra_info.
	(frame_get_saved_regs): Use get_frame_saved_regs.
	(frame_initial_stack_address): Use get_frame_saved_regs and
	get_frame_extra_info.
	(frame_initial_stack_address): Use get_frame_extra_info.

Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.99
diff -u -r1.99 rs6000-tdep.c
--- rs6000-tdep.c	9 Dec 2002 03:30:44 -0000	1.99
+++ rs6000-tdep.c	17 Dec 2002 18:03:08 -0000
@@ -166,9 +166,9 @@
 void
 rs6000_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 {
-  fi->extra_info = (struct frame_extra_info *)
-    frame_obstack_alloc (sizeof (struct frame_extra_info));
-  fi->extra_info->initial_sp = 0;
+  struct frame_extra_info *extra_info =
+    frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
+  extra_info->initial_sp = 0;
   if (get_next_frame (fi) != NULL
       && get_frame_pc (fi) < TEXT_SEGMENT_BASE)
     /* We're in get_prev_frame */
@@ -197,8 +197,9 @@
 static CORE_ADDR
 rs6000_frame_args_address (struct frame_info *fi)
 {
-  if (fi->extra_info->initial_sp != 0)
-    return fi->extra_info->initial_sp;
+  struct frame_extra_info *extra_info = get_frame_extra_info (fi);
+  if (extra_info->initial_sp != 0)
+    return extra_info->initial_sp;
   else
     return frame_initial_stack_address (fi);
 }
@@ -1572,7 +1573,7 @@
   struct gdbarch_tdep * tdep = gdbarch_tdep (current_gdbarch);
   int wordsize = tdep->wordsize;
 
-  if (fi->saved_regs)
+  if (get_frame_saved_regs (fi))
     return;
 
   if (fdatap == NULL)
@@ -1615,7 +1616,7 @@
       CORE_ADDR fpr_addr = frame_addr + fdatap->fpr_offset;
       for (i = fdatap->saved_fpr; i < 32; i++)
 	{
-	  fi->saved_regs[FP0_REGNUM + i] = fpr_addr;
+	  get_frame_saved_regs (fi)[FP0_REGNUM + i] = fpr_addr;
 	  fpr_addr += 8;
 	}
     }
@@ -1629,7 +1630,7 @@
       CORE_ADDR gpr_addr = frame_addr + fdatap->gpr_offset;
       for (i = fdatap->saved_gpr; i < 32; i++)
 	{
-	  fi->saved_regs[i] = gpr_addr;
+	  get_frame_saved_regs (fi)[i] = gpr_addr;
 	  gpr_addr += wordsize;
 	}
     }
@@ -1644,7 +1645,7 @@
 	  CORE_ADDR vr_addr = frame_addr + fdatap->vr_offset;
 	  for (i = fdatap->saved_vr; i < 32; i++)
 	    {
-	      fi->saved_regs[tdep->ppc_vr0_regnum + i] = vr_addr;
+	      get_frame_saved_regs (fi)[tdep->ppc_vr0_regnum + i] = vr_addr;
 	      vr_addr += REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum);
 	    }
 	}
@@ -1660,8 +1661,8 @@
 	  CORE_ADDR ev_addr = frame_addr + fdatap->ev_offset;
 	  for (i = fdatap->saved_ev; i < 32; i++)
 	    {
-	      fi->saved_regs[tdep->ppc_ev0_regnum + i] = ev_addr;
-              fi->saved_regs[tdep->ppc_gp0_regnum + i] = ev_addr + 4;
+	      get_frame_saved_regs (fi)[tdep->ppc_ev0_regnum + i] = ev_addr;
+              get_frame_saved_regs (fi)[tdep->ppc_gp0_regnum + i] = ev_addr + 4;
 	      ev_addr += REGISTER_RAW_SIZE (tdep->ppc_ev0_regnum);
             }
 	}
@@ -1670,17 +1671,17 @@
   /* If != 0, fdatap->cr_offset is the offset from the frame that holds
      the CR.  */
   if (fdatap->cr_offset != 0)
-    fi->saved_regs[tdep->ppc_cr_regnum] = frame_addr + fdatap->cr_offset;
+    get_frame_saved_regs (fi)[tdep->ppc_cr_regnum] = frame_addr + fdatap->cr_offset;
 
   /* If != 0, fdatap->lr_offset is the offset from the frame that holds
      the LR.  */
   if (fdatap->lr_offset != 0)
-    fi->saved_regs[tdep->ppc_lr_regnum] = frame_addr + fdatap->lr_offset;
+    get_frame_saved_regs (fi)[tdep->ppc_lr_regnum] = frame_addr + fdatap->lr_offset;
 
   /* If != 0, fdatap->vrsave_offset is the offset from the frame that holds
      the VRSAVE.  */
   if (fdatap->vrsave_offset != 0)
-    fi->saved_regs[tdep->ppc_vrsave_regnum] = frame_addr + fdatap->vrsave_offset;
+    get_frame_saved_regs (fi)[tdep->ppc_vrsave_regnum] = frame_addr + fdatap->vrsave_offset;
 }
 
 /* Return the address of a frame. This is the inital %sp value when the frame
@@ -1697,8 +1698,8 @@
   /* If the initial stack pointer (frame address) of this frame is known,
      just return it.  */
 
-  if (fi->extra_info->initial_sp)
-    return fi->extra_info->initial_sp;
+  if (get_frame_extra_info (fi)->initial_sp)
+    return get_frame_extra_info (fi)->initial_sp;
 
   /* Find out if this function is using an alloca register.  */
 
@@ -1708,7 +1709,7 @@
   /* If saved registers of this frame are not known yet, read and
      cache them.  */
 
-  if (!fi->saved_regs)
+  if (!get_frame_saved_regs (fi))
     frame_get_saved_regs (fi, &fdata);
 
   /* If no alloca register used, then fi->frame is the value of the %sp for
@@ -1716,8 +1717,8 @@
 
   if (fdata.alloca_reg < 0)
     {
-      fi->extra_info->initial_sp = get_frame_base (fi);
-      return fi->extra_info->initial_sp;
+      get_frame_extra_info (fi)->initial_sp = get_frame_base (fi);
+      return get_frame_extra_info (fi)->initial_sp;
     }
 
   /* There is an alloca register, use its value, in the current frame,
@@ -1726,7 +1727,7 @@
     char *tmpbuf = alloca (MAX_REGISTER_RAW_SIZE);
     if (frame_register_read (fi, fdata.alloca_reg, tmpbuf))
       {
-	fi->extra_info->initial_sp
+	get_frame_extra_info (fi)->initial_sp
 	  = extract_unsigned_integer (tmpbuf,
 				      REGISTER_RAW_SIZE (fdata.alloca_reg));
       }
@@ -1734,9 +1735,9 @@
       /* NOTE: cagney/2002-04-17: At present the only time
          frame_register_read will fail is when the register isn't
          available.  If that does happen, use the frame.  */
-      fi->extra_info->initial_sp = get_frame_base (fi);
+      get_frame_extra_info (fi)->initial_sp = get_frame_base (fi);
   }
-  return fi->extra_info->initial_sp;
+  return get_frame_extra_info (fi)->initial_sp;
 }
 
 /* Describe the pointer in each stack frame to the previous stack frame

             reply	other threads:[~2002-12-17 18:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-17 10:35 Andrew Cagney [this message]
     [not found] ` <ac131313@redhat.com>
2002-12-17 14:13   ` Kevin Buettner
2002-12-18  7:37     ` Andrew Cagney
2003-03-11 23:16   ` [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions Kevin Buettner
2003-03-11 23:18   ` [RFA] mips-tdep.c: Fix printing of floats in "info all-registers" Kevin Buettner
2003-04-02  5:13   ` [RFA] MIPS: Add mappings for HI and LO registers Kevin Buettner
2003-03-04 17:24 [RFA] mips-tdep.c: Fix printing of floats in "info all-registers" Kevin Buettner
2003-03-04 18:01 ` Andrew Cagney
2003-03-04 21:17 [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions Kevin Buettner
2003-03-07 17:04 ` Andrew Cagney
2003-03-07 17:52   ` Kevin Buettner
2003-03-07 18:52     ` Andrew Cagney
2003-03-11 21:22       ` Kevin Buettner
2003-03-11 22:06         ` Andrew Cagney
2003-03-07 19:13     ` Andrew Cagney
2003-03-31 23:11 [RFA] MIPS: Add mappings for HI and LO registers Kevin Buettner
2003-04-02  3:36 ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3DFF68FD.6090403@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox