[lldb] Check for arm64e debugserver in skipUnlessArm64eSupported (#188082)

Explicitly check whether we are building debugserver for arm64e. To
debug an arm64e binary, debugserver itself needs to be an arm64e
process.

This PR eliminates the possibility of configuring LLDB with Right now,
it's possible to configure CMake with
`LLDB_ENABLE_ARM64E_DEBUGSERVER=Off` and the decorator wouldn't account
for that.
This commit is contained in:
Jonas Devlieghere 2026-03-23 14:45:05 -05:00 committed by GitHub
parent 9acfa56d8f
commit f7d5e593d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 35 additions and 1 deletions

View File

@ -150,6 +150,9 @@ enabled_plugins = []
# Whether MTE (Memory Tagging Extension) is enabled.
mte_enabled = False
# Whether debugserver is built with arm64e support.
arm64e_debugserver = False
# the build type of lldb
# Typical values include Debug, Release, RelWithDebInfo and MinSizeRel
cmake_build_type = None

View File

@ -1331,6 +1331,10 @@ def skipUnlessArm64eSupported(func):
if not _compiler_supports(compiler_path, "-arch arm64e"):
return "Compiler cannot target arm64e"
# Need debugserver built with arm64e support.
if not configuration.arm64e_debugserver:
return "debugserver not built with arm64e support"
return None
return skipTestIfFn(can_build_and_run_arm64e)(func)

View File

@ -472,6 +472,9 @@ def parseOptionsAndInitTestdirs():
if args.enable_mte:
configuration.mte_enabled = True
if args.arm64e_debugserver:
configuration.arm64e_debugserver = True
# Gather all the dirs passed on the command line.
if len(args.args) > 0:
configuration.testdirs = [

View File

@ -285,6 +285,12 @@ def create_parser():
action="store_true",
help="Indicate that the test suite is running with MTE (Memory Tagging Extension) enabled.",
)
group.add_argument(
"--arm64e-debugserver",
dest="arm64e_debugserver",
action="store_true",
help="Indicate that debugserver is built with arm64e support.",
)
# Configuration options
group = parser.add_argument_group("Remote platform options")

View File

@ -303,6 +303,9 @@ if is_configured("enabled_plugins"):
if getattr(config, "lldb_enable_mte", False):
dotest_cmd += ["--enable-mte"]
if getattr(config, "lldb_enable_arm64e_debugserver", False):
dotest_cmd += ["--arm64e-debugserver"]
# `dotest` args come from three different sources:
# 1. Derived by CMake based on its configs (LLDB_TEST_COMMON_ARGS), which end
# up in `dotest_common_args_str`.

View File

@ -44,6 +44,7 @@ config.libcxx_include_dir = "@LIBCXX_GENERATED_INCLUDE_DIR@"
config.libcxx_include_target_dir = "@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@"
config.lldb_launcher = "@LLDB_LAUNCHER@"
config.lldb_enable_mte = @LLDB_ENABLE_MTE@
config.lldb_enable_arm64e_debugserver = @LLDB_USE_ARM64E_DEBUGSERVER@
# The API tests use their own module caches.
config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-api")
config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-api")

View File

@ -250,6 +250,10 @@ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(LLDB_IS_64_BITS 1)
endif()
if (LLDB_ENABLE_ARM64E_DEBUGSERVER OR LLDB_USE_SYSTEM_DEBUGSERVER)
set(LLDB_USE_ARM64E_DEBUGSERVER ON)
endif()
set(LLDB_TEST_SHELL_DISABLE_REMOTE OFF CACHE BOOL "Disable remote Shell tests execution")
# These values are not canonicalized within LLVM.
@ -267,7 +271,8 @@ llvm_canonicalize_cmake_booleans(
LLDB_TOOL_LLDB_SERVER_BUILD
LLDB_USE_SYSTEM_DEBUGSERVER
LLDB_IS_64_BITS
LLDB_BUILD_LLDBRPC)
LLDB_BUILD_LLDBRPC
LLDB_USE_ARM64E_DEBUGSERVER)
# Configure the individual test suites.
add_subdirectory(API)

View File

@ -11,9 +11,14 @@ if(TARGET darwin-mte-launcher)
set(LLDB_LAUNCHER ${LLVM_RUNTIME_OUTPUT_INTDIR}/darwin-mte-launcher${CMAKE_EXECUTABLE_SUFFIX})
endif()
if (LLDB_ENABLE_ARM64E_DEBUGSERVER OR LLDB_USE_SYSTEM_DEBUGSERVER)
set(LLDB_USE_ARM64E_DEBUGSERVER ON)
endif()
llvm_canonicalize_cmake_booleans(
LLDB_BUILD_INTEL_PT
LLDB_HAS_LIBCXX
LLDB_USE_ARM64E_DEBUGSERVER
)
if ("libcxx" IN_LIST LLVM_ENABLE_RUNTIMES)
@ -50,6 +55,7 @@ set(vars
LIBCXX_GENERATED_INCLUDE_DIR
LIBCXX_GENERATED_INCLUDE_TARGET_DIR
LLDB_LAUNCHER
LLDB_USE_ARM64E_DEBUGSERVER
)
llvm_canonicalize_cmake_booleans(LLDB_HAS_LIBCXX)

View File

@ -23,6 +23,7 @@ libcxx_libs_dir = "@LIBCXX_LIBRARY_DIR@"
libcxx_include_dir = "@LIBCXX_GENERATED_INCLUDE_DIR@"
libcxx_include_target_dir = "@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@"
cmake_build_type = "@CMAKE_BUILD_TYPE@"
lldb_enable_arm64e_debugserver = @LLDB_USE_ARM64E_DEBUGSERVER@
if __name__ == '__main__':
wrapper_args = sys.argv[1:]
@ -53,6 +54,8 @@ if __name__ == '__main__':
cmd.extend(['--framework', lldb_framework_dir])
if lldb_build_intel_pt == "1":
cmd.extend(['--enable-plugin', 'intel-pt'])
if lldb_enable_arm64e_debugserver:
cmd.extend(['--arm64e-debugserver'])
cmd.extend(['--lldb-obj-root', lldb_obj_root])
cmd.extend(['--cmake-build-type', cmake_build_type])
cmd.extend(wrapper_args)