зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1322735 - Remove MOZ_STACKWALKING define. r=glandium
With frame pointer omission disabled we should always have usable stacks on Windows. This allows us to remove the MOZ_STACKWALKING define as it will always be enabled. MozReview-Commit-ID: 54xs3Hf1r4P --HG-- extra : rebase_source : 5fe27cdeeb464d81fbedc8c02ac187658bd759e7
This commit is contained in:
Родитель
d2ab17a31d
Коммит
2e195de610
|
@ -961,7 +961,6 @@ pref("security.sandbox.content.level", 2);
|
|||
pref("security.sandbox.content.level", 1);
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_STACKWALKING)
|
||||
// This controls the depth of stack trace that is logged when Windows sandbox
|
||||
// logging is turned on. This is only currently available for the content
|
||||
// process because the only other sandbox (for GMP) has too strict a policy to
|
||||
|
@ -969,7 +968,6 @@ pref("security.sandbox.content.level", 1);
|
|||
pref("security.sandbox.windows.log.stackTraceDepth", 0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX) && defined(MOZ_CONTENT_SANDBOX)
|
||||
// This pref is discussed in bug 1083344, the naming is inspired from its
|
||||
|
|
|
@ -25,9 +25,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef MOZ_STACKWALKING
|
||||
#include "mozilla/StackWalk_windows.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
|
||||
|
@ -171,15 +169,11 @@ RegisterExecutableMemory(void* p, size_t bytes, size_t pageSize)
|
|||
|
||||
// XXX NB: The profiler believes this function is only called from the main
|
||||
// thread. If that ever becomes untrue, SPS must be updated immediately.
|
||||
#ifdef MOZ_STACKWALKING
|
||||
AcquireStackWalkWorkaroundLock();
|
||||
#endif
|
||||
|
||||
bool success = RtlAddFunctionTable(&r->runtimeFunction, 1, reinterpret_cast<DWORD64>(p));
|
||||
|
||||
#ifdef MOZ_STACKWALKING
|
||||
ReleaseStackWalkWorkaroundLock();
|
||||
#endif
|
||||
|
||||
return success;
|
||||
}
|
||||
|
@ -191,15 +185,11 @@ UnregisterExecutableMemory(void* p, size_t bytes, size_t pageSize)
|
|||
|
||||
// XXX NB: The profiler believes this function is only called from the main
|
||||
// thread. If that ever becomes untrue, SPS must be updated immediately.
|
||||
#ifdef MOZ_STACKWALKING
|
||||
AcquireStackWalkWorkaroundLock();
|
||||
#endif
|
||||
|
||||
RtlDeleteFunctionTable(&r->runtimeFunction);
|
||||
|
||||
#ifdef MOZ_STACKWALKING
|
||||
ReleaseStackWalkWorkaroundLock();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1511,33 +1511,6 @@ AC_SUBST(MOZ_OPTIMIZE_FLAGS)
|
|||
AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
|
||||
AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable NS_StackWalk.
|
||||
dnl ========================================================
|
||||
|
||||
# On Windows, NS_StackWalk will only work correctly if we have frame pointers
|
||||
# available. That will only be true for non-optimized builds, debug builds or
|
||||
# builds with --enable-profiling in the .mozconfig (which is turned on in
|
||||
# Nightly by default.)
|
||||
case "$OS_TARGET" in
|
||||
WINNT)
|
||||
if test -z "$MOZ_OPTIMIZE" -o -n "$MOZ_PROFILING" -o -n "$MOZ_DEBUG"; then
|
||||
MOZ_STACKWALKING=1
|
||||
else
|
||||
MOZ_STACKWALKING=
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
MOZ_STACKWALKING=1
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "$MOZ_STACKWALKING"; then
|
||||
AC_DEFINE(MOZ_STACKWALKING)
|
||||
fi
|
||||
|
||||
AC_SUBST(MOZ_STACKWALKING)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Disable trace logging
|
||||
dnl ========================================================
|
||||
|
|
|
@ -52,8 +52,6 @@ typedef void
|
|||
* May skip some stack frames due to compiler optimizations or code
|
||||
* generation.
|
||||
*
|
||||
* Note: this (and other helper methods) will only be available when
|
||||
* MOZ_STACKWALKING is defined, so any new consumers must #if based on that.
|
||||
*/
|
||||
MFBT_API bool
|
||||
MozStackWalk(MozWalkStackCallback aCallback, uint32_t aSkipFrames,
|
||||
|
|
|
@ -12,6 +12,7 @@ if CONFIG['OS_ARCH'] == 'WINNT':
|
|||
]
|
||||
|
||||
SOURCES += [
|
||||
'StackWalk.cpp',
|
||||
'TimeStamp.cpp',
|
||||
]
|
||||
|
||||
|
@ -34,13 +35,3 @@ elif CONFIG['OS_ARCH'] == 'Darwin':
|
|||
]
|
||||
elif CONFIG['COMPILE_ENVIRONMENT']:
|
||||
error('No TimeStamp implementation on this platform. Build will not succeed')
|
||||
|
||||
# MOZ_STACKWALKING is defined in configure.in when the build configuration meets
|
||||
# the conditions for GeckoStackWalk to work correctly.
|
||||
# We exclude this file from other build configurations so that if somebody adds a
|
||||
# new usage of NS_StackWalk it will cause a link error, which is better than having
|
||||
# GeckoStackWalk silently return garbage at runtime.
|
||||
if CONFIG['MOZ_STACKWALKING']:
|
||||
SOURCES += [
|
||||
'StackWalk.cpp',
|
||||
]
|
||||
|
|
|
@ -4156,33 +4156,6 @@ AC_SUBST(MOZ_OPTIMIZE_FLAGS)
|
|||
AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
|
||||
AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable NS_StackWalk.
|
||||
dnl ========================================================
|
||||
|
||||
# On Windows, NS_StackWalk will only work correctly if we have frame pointers
|
||||
# available. That will only be true for non-optimized builds, debug builds or
|
||||
# builds with --enable-profiling in the .mozconfig (which is turned on in
|
||||
# Nightly by default.)
|
||||
case "$OS_TARGET" in
|
||||
WINNT)
|
||||
if test -z "$MOZ_OPTIMIZE" -o -n "$MOZ_PROFILING" -o -n "$MOZ_DEBUG"; then
|
||||
MOZ_STACKWALKING=1
|
||||
else
|
||||
MOZ_STACKWALKING=
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
MOZ_STACKWALKING=1
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "$MOZ_STACKWALKING"; then
|
||||
AC_DEFINE(MOZ_STACKWALKING)
|
||||
fi
|
||||
|
||||
AC_SUBST(MOZ_STACKWALKING)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Disable treating compiler warnings as errors
|
||||
dnl ========================================================
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
#include "mozilla/sandboxing/loggingTypes.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
#ifdef MOZ_STACKWALKING
|
||||
#include "mozilla/StackWalk.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -27,7 +25,6 @@ static LazyLogModule sSandboxTargetLog("SandboxTarget");
|
|||
|
||||
namespace sandboxing {
|
||||
|
||||
#ifdef MOZ_STACKWALKING
|
||||
static uint32_t sStackTraceDepth = 0;
|
||||
|
||||
// NS_WalkStackCallback to write a formatted stack frame to an ostringstream.
|
||||
|
@ -43,7 +40,6 @@ StackFrameToOStringStream(uint32_t aFrameNumber, void* aPC, void* aSP,
|
|||
*stream << std::endl << "--" << buf;
|
||||
stream->flush();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Log to the browser console and, if DEBUG build, stderr.
|
||||
static void
|
||||
|
@ -59,7 +55,6 @@ Log(const char* aMessageType,
|
|||
msgStream << " for : " << aContext;
|
||||
}
|
||||
|
||||
#ifdef MOZ_STACKWALKING
|
||||
if (aShouldLogStackTrace) {
|
||||
if (sStackTraceDepth) {
|
||||
msgStream << std::endl << "Stack Trace:";
|
||||
|
@ -67,7 +62,6 @@ Log(const char* aMessageType,
|
|||
&msgStream, 0, nullptr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string msg = msgStream.str();
|
||||
#if defined(DEBUG)
|
||||
|
@ -96,7 +90,7 @@ InitLoggingIfRequired(ProvideLogFunctionCb aProvideLogFunctionCb)
|
|||
PR_GetEnv("MOZ_WIN_SANDBOX_LOGGING")) {
|
||||
aProvideLogFunctionCb(Log);
|
||||
|
||||
#if defined(MOZ_CONTENT_SANDBOX) && defined(MOZ_STACKWALKING)
|
||||
#if defined(MOZ_CONTENT_SANDBOX)
|
||||
// We can only log the stack trace on process types where we know that the
|
||||
// sandbox won't prevent it.
|
||||
if (XRE_IsContentProcess()) {
|
||||
|
|
|
@ -76,11 +76,9 @@
|
|||
|
||||
#if defined(MOZ_ENABLE_PROFILER_SPS)
|
||||
#include "shared-libraries.h"
|
||||
#if defined(MOZ_STACKWALKING)
|
||||
#define ENABLE_STACK_CAPTURE
|
||||
#include "mozilla/StackWalk.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#endif // MOZ_STACKWALKING
|
||||
#endif // MOZ_ENABLE_PROFILER_SPS
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -5,8 +5,7 @@ Cu.import("resource://gre/modules/TelemetryController.jsm", this);
|
|||
Cu.import("resource://gre/modules/AppConstants.jsm", this);
|
||||
|
||||
// We need both in order to capture stacks.
|
||||
const ENABLE_TESTS = AppConstants.MOZ_ENABLE_PROFILER_SPS &&
|
||||
AppConstants.MOZ_STACKWALKING;
|
||||
const ENABLE_TESTS = AppConstants.MOZ_ENABLE_PROFILER_SPS;
|
||||
|
||||
/**
|
||||
* Ensures that the sctucture of the javascript object used for capturing stacks
|
||||
|
|
|
@ -295,13 +295,6 @@ this.AppConstants = Object.freeze({
|
|||
false,
|
||||
#endif
|
||||
|
||||
MOZ_STACKWALKING:
|
||||
#ifdef MOZ_STACKWALKING
|
||||
true,
|
||||
#else
|
||||
false,
|
||||
#endif
|
||||
|
||||
MOZ_ANDROID_ACTIVITY_STREAM:
|
||||
#ifdef MOZ_ANDROID_ACTIVITY_STREAM
|
||||
true,
|
||||
|
|
|
@ -37,9 +37,7 @@
|
|||
// Memory profile
|
||||
#include "nsMemoryReporterManager.h"
|
||||
|
||||
#ifdef MOZ_STACKWALKING
|
||||
#include "mozilla/StackWalk_windows.h"
|
||||
#endif
|
||||
|
||||
|
||||
class PlatformData {
|
||||
|
@ -210,7 +208,6 @@ class SamplerThread : public Thread {
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_STACKWALKING
|
||||
// Threads that may invoke JS require extra attention. Since, on windows,
|
||||
// the jits also need to modify the same dynamic function table that we need
|
||||
// to get a stack trace, we have to be wary of that to avoid deadlock.
|
||||
|
@ -233,7 +230,6 @@ class SamplerThread : public Thread {
|
|||
// we cannot deadlock with them, and should let them run as they please.
|
||||
ReleaseStackWalkWorkaroundLock();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if V8_HOST_ARCH_X64
|
||||
sample->pc = reinterpret_cast<Address>(context.Rip);
|
||||
|
|
|
@ -233,8 +233,6 @@ static const PLHashAllocOps typesToLogHashAllocOps = {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef MOZ_STACKWALKING
|
||||
|
||||
class CodeAddressServiceStringTable final
|
||||
{
|
||||
public:
|
||||
|
@ -277,8 +275,6 @@ typedef mozilla::CodeAddressService<CodeAddressServiceStringTable,
|
|||
|
||||
mozilla::StaticAutoPtr<WalkTheStackCodeAddressService> gCodeAddressService;
|
||||
|
||||
#endif // MOZ_STACKWALKING
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class BloatEntry
|
||||
|
@ -464,7 +460,6 @@ DumpSerialNumbers(PLHashEntry* aHashEntry, int aIndex, void* aClosure)
|
|||
aHashEntry->key,
|
||||
record->refCount);
|
||||
#endif
|
||||
#ifdef MOZ_STACKWALKING
|
||||
if (!record->allocationStack.empty()) {
|
||||
static const size_t bufLen = 1024;
|
||||
char buf[bufLen];
|
||||
|
@ -477,7 +472,6 @@ DumpSerialNumbers(PLHashEntry* aHashEntry, int aIndex, void* aClosure)
|
|||
fprintf(outputFile, "%s\n", buf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return HT_ENUMERATE_NEXT;
|
||||
}
|
||||
|
||||
|
@ -848,7 +842,6 @@ InitTraceLog()
|
|||
|
||||
extern "C" {
|
||||
|
||||
#ifdef MOZ_STACKWALKING
|
||||
static void
|
||||
PrintStackFrame(uint32_t aFrameNumber, void* aPC, void* aSP, void* aClosure)
|
||||
{
|
||||
|
@ -881,17 +874,14 @@ RecordStackFrame(uint32_t /*aFrameNumber*/, void* aPC, void* /*aSP*/,
|
|||
auto locations = static_cast<std::vector<void*>*>(aClosure);
|
||||
locations->push_back(aPC);
|
||||
}
|
||||
#endif // MOZ_STACKWALKING
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
nsTraceRefcnt::WalkTheStack(FILE* aStream)
|
||||
{
|
||||
#ifdef MOZ_STACKWALKING
|
||||
MozStackWalk(PrintStackFrame, /* skipFrames */ 2, /* maxFrames */ 0, aStream,
|
||||
0, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -905,19 +895,16 @@ nsTraceRefcnt::WalkTheStack(FILE* aStream)
|
|||
static void
|
||||
WalkTheStackCached(FILE* aStream)
|
||||
{
|
||||
#ifdef MOZ_STACKWALKING
|
||||
if (!gCodeAddressService) {
|
||||
gCodeAddressService = new WalkTheStackCodeAddressService();
|
||||
}
|
||||
MozStackWalk(PrintStackFrameCached, /* skipFrames */ 2, /* maxFrames */ 0,
|
||||
aStream, 0, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
WalkTheStackSavingLocations(std::vector<void*>& aLocations)
|
||||
{
|
||||
#ifdef MOZ_STACKWALKING
|
||||
if (!gCodeAddressService) {
|
||||
gCodeAddressService = new WalkTheStackCodeAddressService();
|
||||
}
|
||||
|
@ -927,7 +914,6 @@ WalkTheStackSavingLocations(std::vector<void*>& aLocations)
|
|||
1; // NS_LogCtor
|
||||
MozStackWalk(RecordStackFrame, kFramesToSkip, /* maxFrames */ 0,
|
||||
&aLocations, 0, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -938,9 +924,7 @@ NS_LogInit()
|
|||
NS_SetMainThread();
|
||||
|
||||
// FIXME: This is called multiple times, we should probably not allow that.
|
||||
#ifdef MOZ_STACKWALKING
|
||||
StackWalkInitCriticalAddress();
|
||||
#endif
|
||||
if (++gInitCount) {
|
||||
nsTraceRefcnt::SetActivityIsLegal(true);
|
||||
}
|
||||
|
@ -1301,9 +1285,7 @@ NS_LogCOMPtrRelease(void* aCOMPtr, nsISupports* aObject)
|
|||
void
|
||||
nsTraceRefcnt::Shutdown()
|
||||
{
|
||||
#ifdef MOZ_STACKWALKING
|
||||
gCodeAddressService = nullptr;
|
||||
#endif
|
||||
if (gBloatView) {
|
||||
PL_HashTableDestroy(gBloatView);
|
||||
gBloatView = nullptr;
|
||||
|
|
|
@ -35,9 +35,7 @@
|
|||
|
||||
#include "LateWriteChecks.h"
|
||||
|
||||
#if defined(MOZ_STACKWALKING)
|
||||
#define OBSERVE_LATE_WRITES
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче