Bug 950856 - Fail the build if you attempt to use NS_StackWalk on Windows where it won't work; r=froydnj,BenWa

--HG--
extra : rebase_source : 914250c939e4666f4a8630f7e9e57e466b669259
This commit is contained in:
Ehsan Akhgari 2013-12-18 15:03:11 -05:00
parent 2f559956a1
commit 54a364d5ac
3 changed files with 20 additions and 1 deletions

View File

@ -110,7 +110,6 @@ UNIFIED_SOURCES += [
'nsMemoryReporterManager.cpp',
'nsMessageLoop.cpp',
'nsSecurityConsoleMessage.cpp',
'nsStackWalk.cpp',
'nsSystemInfo.cpp',
'nsTraceRefcntImpl.cpp',
'nsUUIDGenerator.cpp',
@ -118,6 +117,17 @@ UNIFIED_SOURCES += [
'VisualEventTracer.cpp',
]
# On Windows, NS_StackWalk will only work correctly if we have frame pointers available.
# That will only be true for non-optimized builds, and for optimized builds with
# --enable-profiling in the .mozconfig (which is turned on in Nightly by default.)
# 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
# NS_StackWalk silently return garbage at runtime.
if CONFIG['OS_TARGET'] != 'WINNT' or (not CONFIG['MOZ_OPTIMIZE'] or CONFIG['MOZ_PROFILING']):
UNIFIED_SOURCES += [
'nsStackWalk.cpp',
]
if CONFIG['OS_ARCH'] == 'Linux':
SOURCES += [
'SystemMemoryReporter.cpp',

View File

@ -34,6 +34,10 @@
#include "LateWriteChecks.h"
#if !defined(XP_WIN) || (!defined(MOZ_OPTIMIZE) || defined(MOZ_PROFILING))
#define OBSERVE_LATE_WRITES
#endif
using namespace mozilla;
/*************************** Auxiliary Declarations ***************************/
@ -106,6 +110,7 @@ private:
void LateWriteObserver::Observe(IOInterposeObserver::Observation& aOb)
{
#ifdef OBSERVE_LATE_WRITES
// Crash if that is the shutdown check mode
if (gShutdownChecks == SCM_CRASH) {
MOZ_CRASH();
@ -201,6 +206,7 @@ void LateWriteObserver::Observe(IOInterposeObserver::Observation& aOb)
}
PR_Delete(finalName.get());
PR_Rename(name, finalName.get());
#endif
}
/******************************* Setup/Teardown *******************************/

View File

@ -75,3 +75,6 @@ DEFINES['OMNIJAR_NAME'] = CONFIG['OMNIJAR_NAME']
if CONFIG['TARGET_XPCOM_ABI']:
DEFINES['TARGET_XPCOM_ABI'] = '"%s"' % CONFIG['TARGET_XPCOM_ABI']
if CONFIG['MOZ_OPTIMIZE']:
DEFINES['MOZ_OPTIMIZE'] = True