mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1895511 - Move MOZ_DEBUGGING_OPTS to moz.configure r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D209734
This commit is contained in:
parent
8b707bc1b5
commit
6d437ba43e
@ -23,36 +23,10 @@ if test -z "$_MOZ_USE_RTTI"; then
|
||||
fi
|
||||
])
|
||||
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
dnl = Debugging Options
|
||||
dnl =
|
||||
dnl ========================================================
|
||||
AC_DEFUN([MOZ_DEBUGGING_OPTS],
|
||||
[
|
||||
|
||||
if test -n "$MOZ_DEBUG"; then
|
||||
if test -n "$COMPILE_ENVIRONMENT"; then
|
||||
AC_MSG_CHECKING([for valid debug flags])
|
||||
_SAVE_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
|
||||
AC_TRY_COMPILE([#include <stdio.h>],
|
||||
[printf("Hello World\n");],
|
||||
_results=yes,
|
||||
_results=no)
|
||||
AC_MSG_RESULT([$_results])
|
||||
if test "$_results" = "no"; then
|
||||
AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
|
||||
fi
|
||||
CFLAGS=$_SAVE_CFLAGS
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
dnl A high level macro for selecting compiler options.
|
||||
AC_DEFUN([MOZ_COMPILER_OPTS],
|
||||
[
|
||||
MOZ_DEBUGGING_OPTS
|
||||
MOZ_RTTI
|
||||
|
||||
if test "$GNU_CC"; then
|
||||
|
@ -115,6 +115,23 @@ def moz_no_debug_rtl(moz_debug, asan, target, enable_jemalloc):
|
||||
set_config("MOZ_NO_DEBUG_RTL", moz_no_debug_rtl)
|
||||
|
||||
|
||||
@depends(
|
||||
try_compile(
|
||||
includes=["stdio.h"],
|
||||
body='puts("Hello World");',
|
||||
check_msg="for valid debug flags",
|
||||
flags=debug_flags,
|
||||
when=moz_debug,
|
||||
),
|
||||
debug_flags,
|
||||
when=moz_debug,
|
||||
)
|
||||
@imports(_from="mozbuild.shellutil", _import="quote")
|
||||
def check_debug_flags(check, flags):
|
||||
if not check:
|
||||
die(f"These compiler flags are invalid: {quote(*flags)}")
|
||||
|
||||
|
||||
# Try to make builds more reproducible and allow sharing built artifacts across
|
||||
# source and object directories by using -ffile-prefix-map and friends. To
|
||||
# "unwind" the prefix maps, use:
|
||||
|
@ -2151,13 +2151,13 @@ try_compile(
|
||||
def default_debug_flags(compiler_info, target):
|
||||
# Debug info is ON by default.
|
||||
if compiler_info.type == "clang-cl":
|
||||
return "-Z7"
|
||||
return ("-Z7",)
|
||||
elif target.kernel == "WINNT" and compiler_info.type == "clang":
|
||||
return "-g -gcodeview"
|
||||
return ("-g", "-gcodeview")
|
||||
# The oldest versions of supported compilers default to DWARF-4, but
|
||||
# newer versions may default to DWARF-5 or newer (e.g. clang 14), which
|
||||
# Valgrind doesn't support. Force-use DWARF-4.
|
||||
return "-gdwarf-4"
|
||||
return ("-gdwarf-4",)
|
||||
|
||||
|
||||
option(env="MOZ_DEBUG_FLAGS", nargs=1, help="Debug compiler flags")
|
||||
@ -2174,14 +2174,15 @@ set_config("MOZ_DEBUG_SYMBOLS", depends_if("--enable-debug-symbols")(lambda _: T
|
||||
|
||||
|
||||
@depends("MOZ_DEBUG_FLAGS", "--enable-debug-symbols", default_debug_flags)
|
||||
@imports(_from="mozbuild.shellutil", _import="split")
|
||||
def debug_flags(env_debug_flags, enable_debug_flags, default_debug_flags):
|
||||
# If MOZ_DEBUG_FLAGS is set, and --enable-debug-symbols is set to a value,
|
||||
# --enable-debug-symbols takes precedence. Note, the value of
|
||||
# --enable-debug-symbols may be implied by --enable-debug.
|
||||
if len(enable_debug_flags):
|
||||
return enable_debug_flags[0]
|
||||
return split(enable_debug_flags[0])
|
||||
if env_debug_flags:
|
||||
return env_debug_flags[0]
|
||||
return split(env_debug_flags[0])
|
||||
return default_debug_flags
|
||||
|
||||
|
||||
|
@ -440,7 +440,6 @@ fi
|
||||
if test -z "$COMPILE_ENVIRONMENT"; then
|
||||
SKIP_COMPILER_CHECKS=1
|
||||
SKIP_LIBRARY_CHECKS=1
|
||||
MOZ_DEBUGGING_OPTS
|
||||
else
|
||||
MOZ_COMPILER_OPTS
|
||||
fi # COMPILE_ENVIRONMENT
|
||||
|
@ -426,9 +426,7 @@ class AsmFlags(BaseCompileFlags):
|
||||
# armasm64 accepts a paucity of options compared to ml/ml64.
|
||||
pass
|
||||
else:
|
||||
debug_flags += self._context.config.substs.get(
|
||||
"MOZ_DEBUG_FLAGS", ""
|
||||
).split()
|
||||
debug_flags += self._context.config.substs.get("MOZ_DEBUG_FLAGS", [])
|
||||
return debug_flags
|
||||
|
||||
|
||||
@ -503,7 +501,7 @@ class TargetCompileFlags(BaseCompileFlags):
|
||||
if self._context.config.substs.get(
|
||||
"MOZ_DEBUG"
|
||||
) or self._context.config.substs.get("MOZ_DEBUG_SYMBOLS"):
|
||||
return self._context.config.substs.get("MOZ_DEBUG_FLAGS", "").split()
|
||||
return self._context.config.substs.get("MOZ_DEBUG_FLAGS", [])
|
||||
return []
|
||||
|
||||
def _warnings_as_errors(self):
|
||||
|
@ -227,7 +227,7 @@ class TestEmitterBasic(unittest.TestCase):
|
||||
def test_debug_flags(self):
|
||||
reader = self.reader(
|
||||
"compile-flags",
|
||||
extra_substs={"MOZ_DEBUG_FLAGS": "-g", "MOZ_DEBUG_SYMBOLS": "1"},
|
||||
extra_substs={"MOZ_DEBUG_FLAGS": ["-g"], "MOZ_DEBUG_SYMBOLS": "1"},
|
||||
)
|
||||
sources, ldflags, lib, flags = self.read_topsrcdir(reader)
|
||||
self.assertIsInstance(flags, ComputedFlags)
|
||||
@ -236,7 +236,7 @@ class TestEmitterBasic(unittest.TestCase):
|
||||
def test_disable_debug_flags(self):
|
||||
reader = self.reader(
|
||||
"compile-flags",
|
||||
extra_substs={"MOZ_DEBUG_FLAGS": "-g", "MOZ_DEBUG_SYMBOLS": ""},
|
||||
extra_substs={"MOZ_DEBUG_FLAGS": ["-g"], "MOZ_DEBUG_SYMBOLS": ""},
|
||||
)
|
||||
sources, ldflags, lib, flags = self.read_topsrcdir(reader)
|
||||
self.assertIsInstance(flags, ComputedFlags)
|
||||
|
Loading…
Reference in New Issue
Block a user