mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 950856 - Fail the build if you attempt to use NS_StackWalk on Windows where it won't work; r=froydnj,BenWa
This commit is contained in:
parent
303aa67e4a
commit
a7d96f6225
@ -110,7 +110,6 @@ UNIFIED_SOURCES += [
|
||||
'nsMemoryReporterManager.cpp',
|
||||
'nsMessageLoop.cpp',
|
||||
'nsSecurityConsoleMessage.cpp',
|
||||
'nsStackWalk.cpp',
|
||||
'nsSystemInfo.cpp',
|
||||
'nsTraceRefcntImpl.cpp',
|
||||
'nsUUIDGenerator.cpp',
|
||||
@ -118,6 +117,18 @@ 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'] or CONFIG['MOZ_DEBUG']):
|
||||
UNIFIED_SOURCES += [
|
||||
'nsStackWalk.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'Linux':
|
||||
SOURCES += [
|
||||
'SystemMemoryReporter.cpp',
|
||||
@ -141,3 +152,6 @@ MSVC_ENABLE_PGO = True
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xpcom_core'
|
||||
|
||||
if CONFIG['MOZ_OPTIMIZE']:
|
||||
DEFINES['MOZ_OPTIMIZE'] = True
|
||||
|
@ -60,6 +60,10 @@ NS_MeanAndStdDev(double n, double sumOfValues, double sumOfSquaredValues,
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(XP_WIN) || (!defined(MOZ_OPTIMIZE) || defined(MOZ_PROFILING) || defined(DEBUG))
|
||||
#define STACKWALKING_AVAILABLE
|
||||
#endif
|
||||
|
||||
#define NS_IMPL_REFCNT_LOGGING
|
||||
|
||||
#ifdef NS_IMPL_REFCNT_LOGGING
|
||||
@ -836,6 +840,7 @@ static void InitTraceLog(void)
|
||||
|
||||
extern "C" {
|
||||
|
||||
#ifdef STACKWALKING_AVAILABLE
|
||||
static void PrintStackFrame(void *aPC, void *aSP, void *aClosure)
|
||||
{
|
||||
FILE *stream = (FILE*)aClosure;
|
||||
@ -846,14 +851,17 @@ static void PrintStackFrame(void *aPC, void *aSP, void *aClosure)
|
||||
NS_FormatCodeAddressDetails(aPC, &details, buf, sizeof(buf));
|
||||
fputs(buf, stream);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
|
||||
{
|
||||
#ifdef STACKWALKING_AVAILABLE
|
||||
NS_StackWalk(PrintStackFrame, /* skipFrames */ 2, /* maxFrames */ 0, aStream,
|
||||
0, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -895,7 +903,9 @@ EXPORT_XPCOM_API(void)
|
||||
NS_LogInit()
|
||||
{
|
||||
// FIXME: This is called multiple times, we should probably not allow that.
|
||||
#ifdef STACKWALKING_AVAILABLE
|
||||
StackWalkInitCriticalAddress();
|
||||
#endif
|
||||
#ifdef NS_IMPL_REFCNT_LOGGING
|
||||
if (++gInitCount)
|
||||
nsTraceRefcntImpl::SetActivityIsLegal(true);
|
||||
|
@ -34,6 +34,10 @@
|
||||
|
||||
#include "LateWriteChecks.h"
|
||||
|
||||
#if !defined(XP_WIN) || (!defined(MOZ_OPTIMIZE) || defined(MOZ_PROFILING) || defined(DEBUG))
|
||||
#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 *******************************/
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user