Jakub Jelinek 0332e1
--- valgrind/coregrind/m_debuginfo/d3basics.c.jj	2009-10-22 17:40:55.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/coregrind/m_debuginfo/d3basics.c	2009-10-23 15:44:21.948199235 +0200
Jakub Jelinek 0332e1
@@ -387,12 +387,8 @@ static Bool get_Dwarf_Reg( /*OUT*/Addr* 
Jakub Jelinek 0332e1
    if (regno == 7/*RSP*/) { *a = regs->sp; return True; }
Jakub Jelinek 0332e1
 #  elif defined(VGP_ppc32_linux)
Jakub Jelinek 0332e1
    if (regno == 1/*SP*/) { *a = regs->sp; return True; }
Jakub Jelinek 0332e1
-   if (regno == 31) return False;
Jakub Jelinek 0332e1
-   vg_assert(0);
Jakub Jelinek 0332e1
 #  elif defined(VGP_ppc64_linux)
Jakub Jelinek 0332e1
    if (regno == 1/*SP*/) { *a = regs->sp; return True; }
Jakub Jelinek 0332e1
-   if (regno == 31) return False;
Jakub Jelinek 0332e1
-   vg_assert(0);
Jakub Jelinek 0332e1
 #  elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
Jakub Jelinek 0332e1
    vg_assert(0); /* this function should never be called */
Jakub Jelinek 0332e1
 #  else
Jakub Jelinek 0332e1
@@ -831,7 +827,12 @@ GXResult ML_(evaluate_Dwarf3_Expr) ( UCh
Jakub Jelinek 0332e1
          case DW_OP_call_frame_cfa:
Jakub Jelinek 0332e1
             if (!regs)
Jakub Jelinek 0332e1
                FAIL("evaluate_Dwarf3_Expr: DW_OP_call_frame_cfa but no reg info");
Jakub Jelinek 0332e1
+#if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
Jakub Jelinek 0332e1
+            /* Valgrind on ppc32/ppc64 currently doesn't use unwind info.  */
Jakub Jelinek 0332e1
+            uw1 = *(Addr *)(regs->sp);
Jakub Jelinek 0332e1
+#else
Jakub Jelinek 0332e1
             uw1 = ML_(get_CFA)(regs->ip, regs->sp, regs->fp, 0, ~(UWord) 0);
Jakub Jelinek 0332e1
+#endif
Jakub Jelinek 0332e1
             if (!uw1)
Jakub Jelinek 0332e1
                FAIL("evaluate_Dwarf3_Expr: Could not resolve "
Jakub Jelinek 0332e1
                     "DW_OP_call_frame_cfa");
Jakub Jelinek 0332e1
--- valgrind/coregrind/m_debuginfo/readdwarf.c.jj	2009-10-22 17:40:55.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/coregrind/m_debuginfo/readdwarf.c	2009-10-23 15:42:17.979217217 +0200
Jakub Jelinek 0332e1
@@ -1778,11 +1778,11 @@ void ML_(read_debuginfo_dwarf1) ( 
Jakub Jelinek 0332e1
 #elif defined(VGP_ppc32_linux)
Jakub Jelinek 0332e1
 #  define FP_REG         1
Jakub Jelinek 0332e1
 #  define SP_REG         1
Jakub Jelinek 0332e1
-#  define RA_REG_DEFAULT 8     // CAB: What's a good default ?
Jakub Jelinek 0332e1
+#  define RA_REG_DEFAULT 65
Jakub Jelinek 0332e1
 #elif defined(VGP_ppc64_linux)
Jakub Jelinek 0332e1
 #  define FP_REG         1
Jakub Jelinek 0332e1
 #  define SP_REG         1
Jakub Jelinek 0332e1
-#  define RA_REG_DEFAULT 8     // CAB: What's a good default ?
Jakub Jelinek 0332e1
+#  define RA_REG_DEFAULT 65
Jakub Jelinek 0332e1
 #elif defined(VGP_x86_darwin)
Jakub Jelinek 0332e1
 #  define FP_REG         5
Jakub Jelinek 0332e1
 #  define SP_REG         4
Jakub Jelinek 0332e1
@@ -1796,7 +1796,11 @@ void ML_(read_debuginfo_dwarf1) ( 
Jakub Jelinek 0332e1
 #endif
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 /* the number of regs we are prepared to unwind */
Jakub Jelinek 0332e1
-#define N_CFI_REGS 20
Jakub Jelinek 0332e1
+#if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
Jakub Jelinek 0332e1
+# define N_CFI_REGS 72
Jakub Jelinek 0332e1
+#else
Jakub Jelinek 0332e1
+# define N_CFI_REGS 20
Jakub Jelinek 0332e1
+#endif
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 /* Instructions for the automaton */
Jakub Jelinek 0332e1
 enum dwarf_cfa_primary_ops
Jakub Jelinek 0332e1
@@ -3422,12 +3426,8 @@ void ML_(read_callframe_info_dwarf3)
Jakub Jelinek 0332e1
    UWord  ehframe_cfsis = 0;   
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
 #  if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
Jakub Jelinek 0332e1
-   if (!VG_(needs).var_info /* the tool requires it */   
Jakub Jelinek 0332e1
-       && !VG_(clo_read_var_info) /* the user asked for it */) {
Jakub Jelinek 0332e1
-      /* These targets don't use CFI-based stack unwinding, but still might
Jakub Jelinek 0332e1
-         need it for DW_OP_call_frame_cfa support. */
Jakub Jelinek 0332e1
-      return;
Jakub Jelinek 0332e1
-   }
Jakub Jelinek 0332e1
+   /* These targets don't use CFI-based stack unwinding.  */
Jakub Jelinek 0332e1
+   return;
Jakub Jelinek 0332e1
 #  endif
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
    /* If we are reading .debug_frame after .eh_frame has been read, only
Jakub Jelinek 0332e1
--- valgrind/coregrind/m_stacktrace.c.jj	2009-08-19 15:37:47.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/coregrind/m_stacktrace.c	2009-10-23 14:57:08.734338026 +0200
Jakub Jelinek 0332e1
@@ -430,9 +430,9 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId 
Jakub Jelinek 0332e1
 #           endif
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
             if (0 == ip || 1 == ip) break;
Jakub Jelinek 0332e1
-            fp = (((UWord*)fp)[0]);
Jakub Jelinek 0332e1
             if (sps) sps[i] = fp; /* NB. not sp */
Jakub Jelinek 0332e1
             if (fps) fps[i] = fp;
Jakub Jelinek 0332e1
+            fp = (((UWord*)fp)[0]);
Jakub Jelinek 0332e1
             ips[i++] = ip - 1; /* -1: refer to calling insn, not the RA */
Jakub Jelinek 0332e1
             if (debug)
Jakub Jelinek 0332e1
                VG_(printf)("     ipsF[%d]=%#08lx\n", i-1, ips[i-1]);