mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 10:43:24 +00:00
Bug 1063455 - Define MOZ_STACKWALKING when NS_StackWalk is available and replace other instances of the same #if logic. r=mshal, r=froydnj
This commit is contained in:
parent
47586c314e
commit
33eaabbf1f
@ -72,6 +72,3 @@ if CONFIG['MOZ_LINKER']:
|
||||
|
||||
if CONFIG['HAVE_CLOCK_MONOTONIC']:
|
||||
OS_LIBS += CONFIG['REALTIME_LIBS']
|
||||
|
||||
if CONFIG['MOZ_OPTIMIZE']:
|
||||
DEFINES['MOZ_OPTIMIZE'] = True
|
||||
|
@ -1186,9 +1186,7 @@ pref("browser.tabs.remote.autostart", false);
|
||||
// This will probably require a restart.
|
||||
pref("browser.tabs.remote.sandbox", "off");
|
||||
|
||||
// This is essentially the same logic that decides whether nsStackWalk.cpp gets
|
||||
// built, which we use for the stack trace. See xpcom/base/moz.build
|
||||
#if !defined(MOZ_OPTIMIZE) || defined(MOZ_PROFILING) || defined(DEBUG)
|
||||
#if defined(MOZ_STACKWALKING)
|
||||
// This controls the depth of stack trace that is logged when the warn only
|
||||
// sandbox reports that a resource access request has been blocked.
|
||||
// This does not require a restart to take effect.
|
||||
|
27
configure.in
27
configure.in
@ -6764,6 +6764,33 @@ AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
|
||||
AC_SUBST(MOZ_PGO)
|
||||
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 = Enable any treating of compile warnings as errors
|
||||
dnl ========================================================
|
||||
|
@ -17,15 +17,10 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
// This is essentially the same logic that decides whether nsStackWalk.cpp gets
|
||||
// built. See xpcom/base/moz.build
|
||||
#if !defined(MOZ_OPTIMIZE) || defined(MOZ_PROFILING) || defined(DEBUG)
|
||||
#define MOZ_STACKWALKING
|
||||
#ifdef MOZ_STACKWALKING
|
||||
#include "nsStackWalk.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_SANDBOX_EXPORTS
|
||||
#define TARGET_SANDBOX_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define TARGET_SANDBOX_EXPORT __declspec(dllimport)
|
||||
|
@ -168,6 +168,3 @@ CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_GTK']:
|
||||
CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
|
||||
|
||||
if CONFIG['MOZ_OPTIMIZE']:
|
||||
DEFINES['MOZ_OPTIMIZE'] = True
|
||||
|
@ -116,14 +116,12 @@ 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.)
|
||||
# MOZ_STACKWALKING is defined in configure.in when the build configuration meets
|
||||
# the conditions for NS_StackWalk 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
|
||||
# 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']):
|
||||
if CONFIG['MOZ_STACKWALKING']:
|
||||
UNIFIED_SOURCES += [
|
||||
'nsStackWalk.cpp',
|
||||
]
|
||||
@ -158,8 +156,5 @@ LOCAL_INCLUDES += [
|
||||
'/xpcom/ds',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_OPTIMIZE']:
|
||||
DEFINES['MOZ_OPTIMIZE'] = True
|
||||
|
||||
if CONFIG['MOZ_WIDGET_GTK']:
|
||||
CXXFLAGS += CONFIG['TK_CFLAGS']
|
||||
|
@ -59,6 +59,9 @@ 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.
|
||||
*/
|
||||
XPCOM_API(nsresult)
|
||||
NS_StackWalk(NS_WalkStackCallback aCallback, uint32_t aSkipFrames,
|
||||
|
@ -69,10 +69,6 @@ NS_MeanAndStdDev(double aNumberOfValues,
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#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
|
||||
@ -209,7 +205,7 @@ static const PLHashAllocOps typesToLogHashAllocOps = {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef STACKWALKING_AVAILABLE
|
||||
#ifdef MOZ_STACKWALKING
|
||||
|
||||
class CodeAddressServiceStringTable MOZ_FINAL
|
||||
{
|
||||
@ -253,7 +249,7 @@ typedef mozilla::CodeAddressService<CodeAddressServiceStringTable,
|
||||
|
||||
mozilla::StaticAutoPtr<WalkTheStackCodeAddressService> gCodeAddressService;
|
||||
|
||||
#endif // STACKWALKING_AVAILABLE
|
||||
#endif // MOZ_STACKWALKING
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -931,7 +927,7 @@ InitTraceLog()
|
||||
|
||||
extern "C" {
|
||||
|
||||
#ifdef STACKWALKING_AVAILABLE
|
||||
#ifdef MOZ_STACKWALKING
|
||||
static void
|
||||
PrintStackFrame(void* aPC, void* aSP, void* aClosure)
|
||||
{
|
||||
@ -960,7 +956,7 @@ PrintStackFrameCached(void* aPC, void* aSP, void* aClosure)
|
||||
void
|
||||
nsTraceRefcnt::WalkTheStack(FILE* aStream)
|
||||
{
|
||||
#ifdef STACKWALKING_AVAILABLE
|
||||
#ifdef MOZ_STACKWALKING
|
||||
NS_StackWalk(PrintStackFrame, /* skipFrames */ 2, /* maxFrames */ 0, aStream,
|
||||
0, nullptr);
|
||||
#endif
|
||||
@ -969,7 +965,7 @@ nsTraceRefcnt::WalkTheStack(FILE* aStream)
|
||||
void
|
||||
nsTraceRefcnt::WalkTheStackCached(FILE* aStream)
|
||||
{
|
||||
#ifdef STACKWALKING_AVAILABLE
|
||||
#ifdef MOZ_STACKWALKING
|
||||
if (!gCodeAddressService) {
|
||||
gCodeAddressService = new WalkTheStackCodeAddressService();
|
||||
}
|
||||
@ -1018,7 +1014,7 @@ NS_LogInit()
|
||||
NS_SetMainThread();
|
||||
|
||||
// FIXME: This is called multiple times, we should probably not allow that.
|
||||
#ifdef STACKWALKING_AVAILABLE
|
||||
#ifdef MOZ_STACKWALKING
|
||||
StackWalkInitCriticalAddress();
|
||||
#endif
|
||||
#ifdef NS_IMPL_REFCNT_LOGGING
|
||||
@ -1368,7 +1364,7 @@ void
|
||||
nsTraceRefcnt::Shutdown()
|
||||
{
|
||||
#ifdef NS_IMPL_REFCNT_LOGGING
|
||||
#ifdef STACKWALKING_AVAILABLE
|
||||
#ifdef MOZ_STACKWALKING
|
||||
gCodeAddressService = nullptr;
|
||||
#endif
|
||||
if (gBloatView) {
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include "LateWriteChecks.h"
|
||||
|
||||
#if !defined(XP_WIN) || (!defined(MOZ_OPTIMIZE) || defined(MOZ_PROFILING) || defined(DEBUG))
|
||||
#if defined(MOZ_STACKWALKING)
|
||||
#define OBSERVE_LATE_WRITES
|
||||
#endif
|
||||
|
||||
|
@ -77,9 +77,6 @@ FINAL_LIBRARY = 'xul'
|
||||
DEFINES['_IMPL_NS_STRINGAPI'] = True
|
||||
DEFINES['OMNIJAR_NAME'] = CONFIG['OMNIJAR_NAME']
|
||||
|
||||
if CONFIG['MOZ_OPTIMIZE']:
|
||||
DEFINES['MOZ_OPTIMIZE'] = True
|
||||
|
||||
GENERATED_INCLUDES += ['..']
|
||||
LOCAL_INCLUDES += [
|
||||
'../base',
|
||||
|
Loading…
Reference in New Issue
Block a user