diff --git a/xpcom/threads/ThreadStackHelper.cpp b/xpcom/threads/ThreadStackHelper.cpp index f5078c4e8c2..17af7d97e8d 100644 --- a/xpcom/threads/ThreadStackHelper.cpp +++ b/xpcom/threads/ThreadStackHelper.cpp @@ -84,7 +84,7 @@ ThreadStackHelper::GetStack(Stack& aStack) { // Always run PrepareStackBuffer first to clear aStack if (!PrepareStackBuffer(aStack)) { - MOZ_ASSERT(false); + // Skip and return empty aStack return; } @@ -149,13 +149,23 @@ ThreadStackHelper::SigAction(int aSignal, siginfo_t* aInfo, void* aContext) bool ThreadStackHelper::PrepareStackBuffer(Stack& aStack) { + // Return false to skip getting the stack and return an empty stack aStack.clear(); #ifdef MOZ_ENABLE_PROFILER_SPS + /* Normally, provided the profiler is enabled, it would be an error if we + don't have a pseudostack here (the thread probably forgot to call + profiler_register_thread). However, on B2G, profiling secondary threads + may be disabled despite profiler being enabled. This is by-design and + is not an error. */ +#ifdef MOZ_WIDGET_GONK if (!mPseudoStack) { return false; } +#endif + MOZ_ASSERT(mPseudoStack); mStackBuffer.clear(); - return mStackBuffer.reserve(mMaxStackSize); + MOZ_ALWAYS_TRUE(mStackBuffer.reserve(mMaxStackSize)); + return true; #else return false; #endif