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

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