Blame SOURCES/gdb-6.3-ia64-sigtramp-frame-20050708.patch

861f93
2005-07-08  Jeff Johnston  <jjohnstn@redhat.com>
861f93
861f93
	* ia64-tdep.c (ia64_sigtramp_frame_prev_register): Build
861f93
	pseudo-registers the same as ia64_pseudo_register_read.
861f93
861f93
2008-04-16  Yi Zhan  <yi.zhan@intel.com>
861f93
861f93
	* ia64-tdep.c (ia64_sigtramp_frame_prev_register): Fix an
861f93
	ISO C compliance compilation error.
861f93
861f93
2008-02-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
861f93
	Port to gdb-6.8.50.20081128, follow the upstream change:
861f93
	http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ia64-tdep.c.diff?cvsroot=src&r1=1.176&r2=1.177
861f93
861f93
Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c
861f93
===================================================================
861f93
--- gdb-6.8.50.20081128.orig/gdb/ia64-tdep.c	2008-11-26 06:27:48.000000000 +0100
861f93
+++ gdb-6.8.50.20081128/gdb/ia64-tdep.c	2008-12-02 19:04:32.000000000 +0100
861f93
@@ -2107,6 +2107,94 @@ ia64_sigtramp_frame_prev_register (struc
861f93
       return frame_unwind_got_constant (this_frame, regnum, pc);
861f93
     }
861f93
 
861f93
+  /* Red Hat patch begin.  */
861f93
+  else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM)
861f93
+    {
861f93
+      /* NAT pseudo registers 0-31: get them from UNAT.
861f93
+       * "copied" from ia64_pseudo_register_read() */
861f93
+      ULONGEST unatN_val;
861f93
+      ULONGEST unat;
861f93
+      read_memory (cache->saved_regs[IA64_UNAT_REGNUM], (char *) &unat,
861f93
+		   register_size (target_gdbarch, IA64_UNAT_REGNUM));
861f93
+      unatN_val = (unat & (1LL << (regnum - IA64_NAT0_REGNUM))) != 0;
861f93
+      return frame_unwind_got_constant (this_frame, regnum, unatN_val);
861f93
+    }
861f93
+  else if (IA64_NAT32_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM)
861f93
+    {
861f93
+      /* NAT pseudo registers 32-127.
861f93
+       * "copied" from ia64_pseudo_register_read()
861f93
+       * FIXME: Not currently tested -- cannot get the frame to include
861f93
+       *        NAT32-NAT127.  */
861f93
+      ULONGEST bsp;
861f93
+      ULONGEST cfm;
861f93
+      ULONGEST natN_val = 0;
861f93
+      CORE_ADDR gr_addr = 0, nat_addr = 0;
861f93
+
861f93
+      read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp,
861f93
+		   register_size (target_gdbarch, IA64_BSP_REGNUM));
861f93
+      read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
861f93
+		   register_size (target_gdbarch, IA64_CFM_REGNUM));
861f93
+
861f93
+      /* The bsp points at the end of the register frame so we
861f93
+	 subtract the size of frame from it to get start of register frame.  */
861f93
+      bsp = rse_address_add (bsp, -(cfm & 0x7f));
861f93
+
861f93
+      if ((cfm & 0x7f) > regnum - V32_REGNUM)
861f93
+	gr_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
861f93
+
861f93
+      if (gr_addr != 0)
861f93
+	{
861f93
+	  /* Compute address of nat collection bits */
861f93
+	  CORE_ADDR nat_collection;
861f93
+	  int nat_bit;
861f93
+	  nat_addr = gr_addr | 0x1f8;
861f93
+	  /* If our nat collection address is bigger than bsp, we have to get
861f93
+	     the nat collection from rnat.  Otherwise, we fetch the nat
861f93
+	     collection from the computed address. FIXME: Do not know if
861f93
+	     RNAT can be not stored in the frame--being extra cautious. */
861f93
+	  if (nat_addr >= bsp)
861f93
+	    {
861f93
+	      nat_addr = cache->saved_regs[IA64_RNAT_REGNUM];
861f93
+	      if (nat_addr != 0)
861f93
+		read_memory (nat_addr, (char *) &nat_collection,
861f93
+			     register_size (target_gdbarch, IA64_RNAT_REGNUM));
861f93
+	    }
861f93
+	  else
861f93
+	    nat_collection = read_memory_integer (nat_addr, 8, BFD_ENDIAN_LITTLE);
861f93
+	  if (nat_addr != 0)
861f93
+	    {
861f93
+	      nat_bit = (gr_addr >> 3) & 0x3f;
861f93
+	      natN_val = (nat_collection >> nat_bit) & 1;
861f93
+	      return frame_unwind_got_constant (this_frame, regnum, natN_val);
861f93
+	    }
861f93
+	}
861f93
+      warning (_("ia64_sigtramp_frame_prev_register: unhandled register %d"),
861f93
+	       regnum);
861f93
+    }
861f93
+  else if (regnum == VBOF_REGNUM)
861f93
+    {
861f93
+      /* BOF pseudo register.
861f93
+       * "copied" from ia64_pseudo_register_read()
861f93
+       *
861f93
+       * A virtual register frame start is provided for user convenience.
861f93
+       * It can be calculated as the bsp - sof (sizeof frame). */
861f93
+      ULONGEST bsp;
861f93
+      ULONGEST cfm;
861f93
+      ULONGEST bof;
861f93
+
861f93
+      read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp,
861f93
+		   register_size (target_gdbarch, IA64_BSP_REGNUM));
861f93
+      read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
861f93
+		   register_size (target_gdbarch, IA64_CFM_REGNUM));
861f93
+
861f93
+      /* The bsp points at the end of the register frame so we
861f93
+	 subtract the size of frame from it to get beginning of frame.  */
861f93
+      bof = rse_address_add (bsp, -(cfm & 0x7f));
861f93
+
861f93
+      return frame_unwind_got_constant (this_frame, regnum, bof);
861f93
+    }
861f93
+  /* Red Hat patch end.  */
861f93
+
861f93
   else if ((regnum >= IA64_GR32_REGNUM && regnum <= IA64_GR127_REGNUM)
861f93
            || (regnum >= V32_REGNUM && regnum <= V127_REGNUM))
861f93
     {
861f93
@@ -2121,7 +2209,42 @@ ia64_sigtramp_frame_prev_register (struc
861f93
       return frame_unwind_got_constant (this_frame, regnum, 0);
861f93
     }
861f93
 
861f93
-  else  /* All other registers not listed above.  */
861f93
+  /* Red Hat patch begin.  */
861f93
+  else if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM)
861f93
+    {
861f93
+      /* VP 0-63.
861f93
+       * "copied" from ia64_pseudo_register_read()
861f93
+       *
861f93
+       * FIXME: Not currently tested--cannot get the frame to include PR. */
861f93
+      CORE_ADDR pr_addr = 0;
861f93
+
861f93
+      pr_addr = cache->saved_regs[IA64_PR_REGNUM];
861f93
+      if (pr_addr != 0)
861f93
+	{
861f93
+	  ULONGEST pr;
861f93
+	  ULONGEST cfm;
861f93
+	  ULONGEST prN_val;
861f93
+	  read_memory (pr_addr, (char *) &pr,
861f93
+		       register_size (target_gdbarch, IA64_PR_REGNUM));
861f93
+	  read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
861f93
+		       register_size (target_gdbarch, IA64_CFM_REGNUM));
861f93
+
861f93
+	  /* Get the register rename base for this frame and adjust the
861f93
+	   * register name to take rotation into account. */
861f93
+	  if (VP16_REGNUM <= regnum && regnum <= VP63_REGNUM)
861f93
+	    {
861f93
+	      int rrb_pr = (cfm >> 32) & 0x3f;
861f93
+	      regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
861f93
+	    }
861f93
+	  prN_val = (pr & (1LL << (regnum - VP0_REGNUM))) != 0;
861f93
+	  return frame_unwind_got_constant (this_frame, regnum, prN_val);
861f93
+	}
861f93
+      warning (_("ia64_sigtramp_frame_prev_register: unhandled register %d"),
861f93
+	       regnum);
861f93
+    }
861f93
+  /* Red Hat patch end.  */
861f93
+
861f93
+  /* All other registers not listed above.  */
861f93
     {
861f93
       CORE_ADDR addr = cache->saved_regs[regnum];
861f93