Bug 1350211 - Re-enable native stack walking on Android. r=mstange, a=gchang
☠☠ backed out by 6ea48bfb0901 ☠ ☠
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 24 Mar 2017 17:02:54 +1100
changeset 375542 e23fd0f551cb50c89b8bedabed3950e85c265f88
parent 375541 832e775121266ed4f5db07c8d718a7e5df0c956e
child 375543 aadc19c0663d4a5805b581c287cbc209ca24cba5
push id10967
push userryanvm@gmail.com
push dateTue, 28 Mar 2017 21:42:19 +0000
treeherdermozilla-aurora@3e5bbabd5279 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, gchang
bugs1350211, 1339695
milestone54.0a2
Bug 1350211 - Re-enable native stack walking on Android. r=mstange, a=gchang Bug 1339695 part 8 accidentally disabled native stack walking on Android by using GP_arm_android instead of GP_PLAT_arm_android in a #if. This patch fixes that. It also fixes a couple of compile errors that crept into the relevant code while it was disabled.
tools/profiler/core/platform.cpp
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -50,17 +50,17 @@
 #endif
 
 #if defined(MOZ_PROFILING) && \
     (defined(GP_OS_windows) || defined(GP_OS_darwin))
 # define USE_NS_STACKWALK
 #endif
 
 // This should also work on ARM Linux, but not tested there yet.
-#if defined(GP_arm_android)
+#if defined(GP_PLAT_arm_android)
 # define USE_EHABI_STACKWALK
 # include "EHABIStackWalk.h"
 #endif
 
 #if defined(GP_PLAT_amd64_linux) || defined(GP_PLAT_x86_linux)
 # define USE_LUL_STACKWALK
 # include "lul/LulMain.h"
 # include "lul/platform-linux-lul.h"
@@ -599,19 +599,17 @@ DoNativeBacktrace(Profile* aBuffer, Tick
     sp_array,
     mozilla::ArrayLength(pc_array),
     0
   };
 
   const mcontext_t* mcontext =
     &reinterpret_cast<ucontext_t*>(aSample->context)->uc_mcontext;
   mcontext_t savedContext;
-  PseudoStack* pseudoStack = aInfo.Stack();
-
-  nativeStack.count = 0;
+  PseudoStack* pseudoStack = aSample->threadInfo->Stack();
 
   // The pseudostack contains an "EnterJIT" frame whenever we enter
   // JIT code with profiling enabled; the stack pointer value points
   // the saved registers.  We use this to unwind resume unwinding
   // after encounting JIT code.
   for (uint32_t i = pseudoStack->stackSize(); i > 0; --i) {
     // The pseudostack grows towards higher indices, so we iterate
     // backwards (from callee to caller).
@@ -645,22 +643,22 @@ DoNativeBacktrace(Profile* aBuffer, Tick
       savedContext.arm_pc  = savedContext.arm_lr;
       mcontext = &savedContext;
     }
   }
 
   // Now unwind whatever's left (starting from either the last EnterJIT frame
   // or, if no EnterJIT was found, the original registers).
   nativeStack.count += EHABIStackWalk(*mcontext,
-                                      aInfo.StackTop(),
+                                      aSample->threadInfo->StackTop(),
                                       sp_array + nativeStack.count,
                                       pc_array + nativeStack.count,
                                       nativeStack.size - nativeStack.count);
 
-  MergeStacksIntoProfile(aInfo, aSample, nativeStack);
+  MergeStacksIntoProfile(aBuffer, aSample, nativeStack);
 }
 #endif
 
 #ifdef USE_LUL_STACKWALK
 static void
 DoNativeBacktrace(ProfileBuffer* aBuffer, TickSample* aSample)
 {
   const mcontext_t* mc =