SERVER-80606: config settings for gdbserver

This commit is contained in:
Udita Bose 2023-11-06 18:57:17 +00:00 committed by Evergreen Agent
parent 0b9e8acbc6
commit 640c456085
5 changed files with 39 additions and 1 deletions

View File

@ -42,3 +42,7 @@ build:local --tls_client_key=
build:local --experimental_remote_cache_compression=false
build:local --grpc_keepalive_time=0s
build:local --legacy_important_outputs
# try to import the bazelrc files if available
try-import %workspace%/.bazelrc.local

1
.gitignore vendored
View File

@ -273,6 +273,7 @@ bazel-mongo*
bazel-out
bazel-testlogs
bazelisk
.bazelrc.local
# generated configs for external fixture suites
docker_compose/

View File

@ -1,4 +1,4 @@
load("//bazel/config:configs.bzl", "build_mode", "compiler_type", "use_libunwind")
load("//bazel/config:configs.bzl", "build_mode", "compiler_type", "use_libunwind", "use_gdbserver")
package(default_visibility = ["//visibility:public"])
@ -223,3 +223,21 @@ config_setting(
"//bazel/config:use_libunwind": "True",
},
)
# --------------------------------------
# gdbserver options
# --------------------------------------
use_gdbserver(
name = "use_gdbserver",
build_setting_default = False,
)
config_setting(
name = "use_gdbserver_enabled",
flag_values = {
"//bazel/config:use_gdbserver": "True",
}
)

View File

@ -36,6 +36,20 @@ build_mode = rule(
build_setting = config.string(flag = True),
)
# =========
# gdbserver
# =========
use_gdbserver_provider = provider(
doc = "Choose if gdbserver should be used"
fields = ["type"],
)
use_gdbserver = rule(
implementation = lambda ctx: use_gdbserver_provider(type = ctx.build_setting_value),
build_setting = config.bool(flag = True),
)
# =========
# libunwind
# =========

View File

@ -336,6 +336,7 @@ def generate(env: SCons.Environment.Environment) -> None:
f'--//bazel/config:compiler_type={env.ToolchainName()}',
f'--//bazel/config:build_mode={build_mode}',
f'--//bazel/config:use_libunwind={env["USE_VENDORED_LIBUNWIND"]}',
f'--//bazel/config:use_gdbserver={False if env.GetOption("gdbserver") is None else True}',
'--compilation_mode=dbg', # always build this compilation mode as we always build with -g
'--dynamic_mode=%s' % ('off' if static_link else 'fully'),
]