diff --git a/SConstruct b/SConstruct index 7d76a66eb6d..63ac550e91a 100644 --- a/SConstruct +++ b/SConstruct @@ -349,14 +349,12 @@ add_option( type="choice", ) - add_option( "debug-symbols", - choices=["on", "off"], - const="on", + choices=["on", "off", "minimal"], default=build_profile.debug_symbols, help="Enable producing debug symbols", - nargs="?", + nargs=1, type="choice", ) @@ -2146,7 +2144,7 @@ env.AddMethod(is_toolchain, "ToolchainIs") releaseBuild = get_option("release") == "on" debugBuild = get_option("dbg") == "on" -debug_symbols = get_option("debug-symbols") == "on" +debug_symbols = get_option("debug-symbols") != "off" optBuild = mongo_generators.get_opt_options(env) if env.get("ENABLE_BUILD_RETRY"): @@ -4700,8 +4698,10 @@ def doConfigure(myenv): # Turn off debug symbols. Due to g0 disabling any previously added debugging flags, # it is easier to append g0 near the end rather than trying to not add all the other # debug flags. This should be added after any debug flags. - if not debug_symbols: + if get_option("debug-symbols") == "off": myenv.AppendUnique(LINKFLAGS=["-g0"], CCFLAGS=["-g0"]) + elif get_option("debug-symbols") == "minimal": + myenv.AppendUnique(LINKFLAGS=["-g1"], CCFLAGS=["-g1"]) # Our build is already parallel. if not myenv.AddToLINKFLAGSIfSupported("-Wl,--no-threads"): diff --git a/etc/evergreen_yml_components/variants/amazon/test_dev_master_branch_only.yml b/etc/evergreen_yml_components/variants/amazon/test_dev_master_branch_only.yml index bfb5cca0ffe..1fd5312803e 100644 --- a/etc/evergreen_yml_components/variants/amazon/test_dev_master_branch_only.yml +++ b/etc/evergreen_yml_components/variants/amazon/test_dev_master_branch_only.yml @@ -253,6 +253,8 @@ buildvariants: MONGO_DISTMOD=amazon2 -j$(grep -c ^processor /proc/cpuinfo) --variables-files=etc/scons/mongodbtoolchain_stable_gcc.vars + --debug-symbols=minimal + separate_debug: off scons_cache_scope: shared compile_variant: *al2023-arm64-sep-benchmark tasks: diff --git a/etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml b/etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml index f40748cdb3d..1fb4252f521 100644 --- a/etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml +++ b/etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml @@ -387,6 +387,8 @@ buildvariants: MONGO_DISTMOD=rhel88 -j$(grep -c ^processor /proc/cpuinfo) --variables-files=etc/scons/mongodbtoolchain_stable_gcc.vars + --debug-symbols=minimal + separate_debug: off scons_cache_scope: shared num_scons_link_jobs_available: 0.5 compile_variant: *enterprise-rhel-8-benchmarks diff --git a/site_scons/site_tools/integrate_bazel.py b/site_scons/site_tools/integrate_bazel.py index 2f087fe7a39..cc1f27d15f8 100644 --- a/site_scons/site_tools/integrate_bazel.py +++ b/site_scons/site_tools/integrate_bazel.py @@ -1289,7 +1289,8 @@ def generate(env: SCons.Environment.Environment) -> None: f"--compiler_type={env.ToolchainName()}", f'--opt={env.GetOption("opt")}', f'--dbg={env.GetOption("dbg") == "on"}', - f'--debug_symbols={env.GetOption("debug-symbols") == "on"}', + f'--debug_symbols={env.GetOption("debug-symbols") != "off"}', + f'--dbg_level={1 if env.GetOption("debug-symbols") == "minimal" else 2}', f'--thin_lto={env.GetOption("thin-lto") is not None}', f'--separate_debug={True if env.GetOption("separate-debug") == "on" else False}', f'--libunwind={env.GetOption("use-libunwind")}',