[Lldb-commits] [lldb] [lldb] Match runtime linkage names without indexing unrelated symbols (PR #232694)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 16 06:50:28 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Karim Alweheshy (karim-alweheshy)
<details>
<summary>Changes</summary>
**Why:** Probing a module for a few known runtime functions currently builds demangled-name indexes for all its symbols. BoundsSafety repeats these probes as libraries load.
**Change:** Add opt-in exact linkage-name matching by scanning symbols, then use it for BoundsSafety detection and breakpoints. Normal symbol providers and DWARF lookup remain in use. Resolver copies and saved breakpoints retain the matching mode.
**Scope:** Review the lookup API and BoundsSafety consumer here. The qSymbol (#<!-- -->232696) and JIT (#<!-- -->232697) consumers are separate children.
**Validation:** All 16 selected native tests and 19 active Darwin API variants pass. Native tests verify that these probes avoid name indexing; API tests cover detection and activation across hidden/static symbols, stripped binaries with dSYMs and late-loaded libraries. Other debug-format variants are unsupported or skipped.
<details>
<summary>Prior reviews and compatibility</summary>
Preserve Symtab locking from #<!-- -->192753 and source-name/DWARF distinctions from #<!-- -->205701. Closed #<!-- -->110543 concerns a language-specific workaround, rather than rejecting this API. Default lookup, linker-annotation aliases, symbol order/kinds and configured target-language handling are preserved.
</details>
Assisted-by: OpenAI Codex
<!-- av pr metadata
This information is embedded by the av CLI when creating PRs to track the status of stacks when using Aviator. Please do not delete or edit this section of the PR.
```
{"parent":"main","parentHead":"","trunk":"main"}
```
-->
---
Patch is 45.93 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/232694.diff
20 Files Affected:
- (modified) lldb/include/lldb/Breakpoint/BreakpointResolverName.h (+9)
- (modified) lldb/include/lldb/Core/Module.h (+7-1)
- (modified) lldb/include/lldb/Core/ModuleList.h (+2-1)
- (modified) lldb/include/lldb/Symbol/Symtab.h (+6-2)
- (modified) lldb/source/Breakpoint/BreakpointResolverName.cpp (+23-1)
- (modified) lldb/source/Core/Module.cpp (+9-4)
- (modified) lldb/source/Core/ModuleList.cpp (+4-2)
- (modified) lldb/source/Plugins/InstrumentationRuntime/BoundsSafety/InstrumentationRuntimeBoundsSafety.cpp (+43-17)
- (modified) lldb/source/Symbol/Symtab.cpp (+45-5)
- (added) lldb/test/API/lang/BoundsSafety/runtime_detection/Makefile (+16)
- (added) lldb/test/API/lang/BoundsSafety/runtime_detection/TestBoundsSafetyRuntimeDetection.py (+163)
- (added) lldb/test/API/lang/BoundsSafety/runtime_detection/cxx_runtime.cpp (+2)
- (added) lldb/test/API/lang/BoundsSafety/runtime_detection/late_runtime.cpp (+2)
- (added) lldb/test/API/lang/BoundsSafety/runtime_detection/library_runtime.c (+2)
- (added) lldb/test/API/lang/BoundsSafety/runtime_detection/main.c (+30)
- (added) lldb/test/API/lang/BoundsSafety/runtime_detection/runtime.c (+25)
- (added) lldb/test/API/lang/BoundsSafety/runtime_detection/unrelated.cpp (+5)
- (modified) lldb/unittests/Symbol/SymtabTest.cpp (+211)
- (modified) lldb/unittests/Target/CMakeLists.txt (+2)
- (added) lldb/unittests/Target/InstrumentationRuntimeTest.cpp (+145)
``````````diff
diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverName.h b/lldb/include/lldb/Breakpoint/BreakpointResolverName.h
index 33b5db966c9742..e4da5c6609c1b2 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolverName.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolverName.h
@@ -58,6 +58,14 @@ class BreakpointResolverName : public BreakpointResolver {
~BreakpointResolverName() override = default;
+ /// Match exact symbol-table linkage names without building demangled-name
+ /// indexes. DWARF lookup and pruning retain their source-name behavior.
+ /// This option applies only to exact-name resolvers.
+ void SetMatchLinkageNames(bool match) {
+ assert(!match || m_match_type == Breakpoint::Exact);
+ m_match_linkage_names = match;
+ }
+
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
SymbolContext &context,
Address *addr) override;
@@ -85,6 +93,7 @@ class BreakpointResolverName : public BreakpointResolver {
Breakpoint::MatchType m_match_type;
lldb::LanguageType m_language;
bool m_skip_prologue;
+ bool m_match_linkage_names = false;
void AddNameLookup(llvm::StringRef name,
lldb::FunctionNameType name_type_mask);
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index e71a29e3e413b9..468198572a18ac 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -69,6 +69,9 @@ struct ModuleFunctionSearchOptions {
bool include_symbols = false;
/// Include inlined functions.
bool include_inlines = false;
+ /// Match exact symbol-table linkage spellings without demangling unrelated
+ /// symbols. DWARF function lookup retains its source-name behavior.
+ bool match_linkage_names = false;
};
/// \class Module Module.h "lldb/Core/Module.h"
@@ -262,9 +265,12 @@ class Module : public std::enable_shared_from_this<Module>,
const Symbol *FindFirstSymbolWithNameAndType(
ConstString name, lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
+ /// When match_linkage_names is true, match exact linkage spellings and linker
+ /// annotation aliases without building the demangled name indexes.
void FindSymbolsWithNameAndType(ConstString name,
lldb::SymbolType symbol_type,
- SymbolContextList &sc_list);
+ SymbolContextList &sc_list,
+ bool match_linkage_names = false);
void FindSymbolsMatchingRegExAndType(
const RegularExpression ®ex, lldb::SymbolType symbol_type,
diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h
index 61259b54d7e39b..4cfe57dda6c6a9 100644
--- a/lldb/include/lldb/Core/ModuleList.h
+++ b/lldb/include/lldb/Core/ModuleList.h
@@ -389,7 +389,8 @@ class ModuleList {
void FindSymbolsWithNameAndType(ConstString name,
lldb::SymbolType symbol_type,
- SymbolContextList &sc_list) const;
+ SymbolContextList &sc_list,
+ bool match_linkage_names = false) const;
void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
lldb::SymbolType symbol_type,
diff --git a/lldb/include/lldb/Symbol/Symtab.h b/lldb/include/lldb/Symbol/Symtab.h
index 224de9e775859f..fa5a86f64e2054 100644
--- a/lldb/include/lldb/Symbol/Symtab.h
+++ b/lldb/include/lldb/Symbol/Symtab.h
@@ -101,7 +101,8 @@ class Symtab {
Mangled::NamePreference::ePreferDemangled);
void FindAllSymbolsWithNameAndType(ConstString name,
lldb::SymbolType symbol_type,
- std::vector<uint32_t> &symbol_indexes);
+ std::vector<uint32_t> &symbol_indexes,
+ bool match_linkage_names = false);
void FindAllSymbolsWithNameAndType(ConstString name,
lldb::SymbolType symbol_type,
Debug symbol_debug_type,
@@ -120,8 +121,11 @@ class Symtab {
Symbol *FindSymbolContainingFileAddress(lldb::addr_t file_addr);
void ForEachSymbolContainingFileAddress(
lldb::addr_t file_addr, std::function<bool(Symbol *)> const &callback);
+ /// When match_linkage_names is true, match only the exact linkage spelling,
+ /// including linker annotation aliases, without building demangled indexes.
void FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
- SymbolContextList &sc_list);
+ SymbolContextList &sc_list,
+ bool match_linkage_names = false);
void SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
bool remove_duplicates) const;
diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp
index 981b6fba708d6a..b1a03ffd7aff55 100644
--- a/lldb/source/Breakpoint/BreakpointResolverName.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp
@@ -24,6 +24,8 @@
using namespace lldb;
using namespace lldb_private;
+static constexpr llvm::StringLiteral MatchLinkageNames("MatchLinkageNames");
+
BreakpointResolverName::BreakpointResolverName(
const BreakpointSP &bkpt, const char *name_cstr,
FunctionNameType name_type_mask, LanguageType language,
@@ -84,7 +86,8 @@ BreakpointResolverName::BreakpointResolverName(
rhs.GetOffset(), rhs.GetOffsetIsInsnCount()),
m_lookups(rhs.m_lookups), m_regex(rhs.m_regex),
m_match_type(rhs.m_match_type), m_language(rhs.m_language),
- m_skip_prologue(rhs.m_skip_prologue) {}
+ m_skip_prologue(rhs.m_skip_prologue),
+ m_match_linkage_names(rhs.m_match_linkage_names) {}
BreakpointResolverSP BreakpointResolverName::CreateFromStructuredData(
const StructuredData::Dictionary &options_dict, Status &error) {
@@ -117,10 +120,24 @@ BreakpointResolverSP BreakpointResolverName::CreateFromStructuredData(
return nullptr;
}
+ bool match_linkage_names = false;
+ if (options_dict.HasKey(MatchLinkageNames) &&
+ !options_dict.GetValueForKeyAsBoolean(MatchLinkageNames,
+ match_linkage_names)) {
+ error = Status::FromErrorString(
+ "BRN::CFSD: MatchLinkageNames entry is not a boolean.");
+ return nullptr;
+ }
+
llvm::StringRef regex_text;
success = options_dict.GetValueForKeyAsString(
GetKey(OptionNames::RegexString), regex_text);
if (success) {
+ if (match_linkage_names) {
+ error = Status::FromErrorString(
+ "BRN::CFSD: Linkage names require an exact-name resolver.");
+ return nullptr;
+ }
return std::make_shared<BreakpointResolverName>(
nullptr, RegularExpression(regex_text), language, offset,
skip_prologue);
@@ -182,6 +199,7 @@ BreakpointResolverSP BreakpointResolverName::CreateFromStructuredData(
for (size_t i = 1; i < num_elem; i++) {
resolver_sp->AddNameLookup(names[i], name_masks[i]);
}
+ resolver_sp->SetMatchLinkageNames(match_linkage_names);
return resolver_sp;
}
@@ -211,6 +229,9 @@ StructuredData::ObjectSP BreakpointResolverName::SerializeToStructuredData() {
options_dict_sp->AddBooleanItem(GetKey(OptionNames::SkipPrologue),
m_skip_prologue);
+ if (m_match_linkage_names)
+ options_dict_sp->AddBooleanItem(MatchLinkageNames, true);
+
return WrapOptionsDict(options_dict_sp);
}
@@ -264,6 +285,7 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter,
ModuleFunctionSearchOptions function_options;
function_options.include_symbols = !filter_by_cu;
function_options.include_inlines = true;
+ function_options.match_linkage_names = m_match_linkage_names;
switch (m_match_type) {
case Breakpoint::Exact:
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 7eab74e57766e9..00b518ddcb9794 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -817,8 +817,11 @@ void Module::FindFunctions(llvm::ArrayRef<Module::LookupInfo> lookup_infos,
options.include_inlines, sc_list);
if (options.include_symbols)
if (Symtab *symtab = symbols->GetSymtab())
- symtab->FindFunctionSymbols(lookup_info.GetLookupName(),
- lookup_info.GetNameTypeMask(), sc_list);
+ symtab->FindFunctionSymbols(options.match_linkage_names
+ ? lookup_info.GetName()
+ : lookup_info.GetLookupName(),
+ lookup_info.GetNameTypeMask(), sc_list,
+ options.match_linkage_names);
}
}
@@ -1306,12 +1309,14 @@ void Module::FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
void Module::FindSymbolsWithNameAndType(ConstString name,
SymbolType symbol_type,
- SymbolContextList &sc_list) {
+ SymbolContextList &sc_list,
+ bool match_linkage_names) {
// No need to protect this call using m_mutex all other method calls are
// already thread safe.
if (Symtab *symtab = GetSymtab()) {
std::vector<uint32_t> symbol_indexes;
- symtab->FindAllSymbolsWithNameAndType(name, symbol_type, symbol_indexes);
+ symtab->FindAllSymbolsWithNameAndType(name, symbol_type, symbol_indexes,
+ match_linkage_names);
SymbolIndicesToSymbolContextList(symtab, symbol_indexes, sc_list);
}
}
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 9f5614538a9874..7e76e17eabf8a3 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -560,10 +560,12 @@ void ModuleList::FindGlobalVariables(const RegularExpression ®ex,
void ModuleList::FindSymbolsWithNameAndType(ConstString name,
SymbolType symbol_type,
- SymbolContextList &sc_list) const {
+ SymbolContextList &sc_list,
+ bool match_linkage_names) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
for (const ModuleSP &module_sp : m_modules)
- module_sp->FindSymbolsWithNameAndType(name, symbol_type, sc_list);
+ module_sp->FindSymbolsWithNameAndType(name, symbol_type, sc_list,
+ match_linkage_names);
}
void ModuleList::FindSymbolsMatchingRegExAndType(
diff --git a/lldb/source/Plugins/InstrumentationRuntime/BoundsSafety/InstrumentationRuntimeBoundsSafety.cpp b/lldb/source/Plugins/InstrumentationRuntime/BoundsSafety/InstrumentationRuntimeBoundsSafety.cpp
index 506785ad15e1b4..e7bfc4c08cb428 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/BoundsSafety/InstrumentationRuntimeBoundsSafety.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/BoundsSafety/InstrumentationRuntimeBoundsSafety.cpp
@@ -9,13 +9,17 @@
#include "InstrumentationRuntimeBoundsSafety.h"
#include "Plugins/Process/Utility/HistoryThread.h"
+#include "lldb/Breakpoint/BreakpointResolverName.h"
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/SearchFilter.h"
#include "lldb/Symbol/Block.h"
+#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/Symtab.h"
#include "lldb/Symbol/Variable.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/InstrumentationRuntimeStopInfo.h"
@@ -29,6 +33,7 @@
#include "clang/CodeGen/ModuleBuilder.h"
#include <memory>
+#include <mutex>
#include <type_traits>
using namespace lldb;
@@ -386,15 +391,31 @@ InstrumentationRuntimeBoundsSafety::GetPatternForRuntimeLibrary() {
bool InstrumentationRuntimeBoundsSafety::CheckIfRuntimeIsValid(
const lldb::ModuleSP module_sp) {
Log *log_category = GetLog(LLDBLog::InstrumentationRuntime);
- for (const auto &SoftTrapFunc : getBoundsSafetySoftTrapRuntimeFuncs()) {
- ConstString test_sym(SoftTrapFunc);
-
- if (module_sp->FindFirstSymbolWithNameAndType(test_sym,
- lldb::eSymbolTypeAny)) {
- LLDB_LOG(log_category, "found \"{0}\" in {1}",
- test_sym.AsCString("<unknown symbol>"),
- module_sp->GetFileSpec().GetPath());
- return true;
+ if (Symtab *symtab = module_sp->GetSymtab()) {
+ const ConstString minimal(BoundsSafetySoftTrapMinimal);
+ const ConstString with_str(BoundsSafetySoftTrapStr);
+ std::lock_guard<std::recursive_mutex> guard(symtab->GetMutex());
+ const size_t num_symbols = symtab->GetNumSymbols();
+ for (size_t i = 0; i < num_symbols; ++i) {
+ Symbol *symbol = symtab->SymbolAtIndex(i);
+ if (symbol->IsTrampoline())
+ continue;
+ // These runtime entry points have C linkage. Their presence does not
+ // require indexing or demangling every other symbol in the module.
+ ConstString name = symbol->GetMangled().GetName(Mangled::ePreferMangled);
+ bool matches = name == minimal || name == with_str;
+ if (!matches && symbol->ContainsLinkerAnnotations()) {
+ llvm::StringRef stripped =
+ symtab->GetObjectFile()->StripLinkerSymbolAnnotations(
+ name.GetStringRef());
+ matches = stripped == BoundsSafetySoftTrapMinimal ||
+ stripped == BoundsSafetySoftTrapStr;
+ }
+ if (matches && !symbol->IsSyntheticWithAutoGeneratedName()) {
+ LLDB_LOG(log_category, "found \"{0}\" in {1}", name,
+ module_sp->GetFileSpec().GetPath());
+ return true;
+ }
}
}
LLDB_LOG(log_category,
@@ -451,14 +472,19 @@ void InstrumentationRuntimeBoundsSafety::Activate() {
for (auto &breakpoint_func : getBoundsSafetySoftTrapRuntimeFuncs())
breakpoints.emplace_back(breakpoint_func);
- BreakpointSP breakpoint = process_sp->GetTarget().CreateBreakpoint(
- /*containingModules=*/nullptr,
- /*containingSourceFiles=*/nullptr, breakpoints, eFunctionNameTypeFull,
- eLanguageTypeUnknown,
- /*m_offset=*/0,
- /*skip_prologue*/ eLazyBoolNo,
- /*internal=*/true,
- /*request_hardware*/ false);
+ Target &target = process_sp->GetTarget();
+ SearchFilterSP filter =
+ std::make_shared<SearchFilterForUnconstrainedSearches>(
+ target.shared_from_this());
+ auto resolver = std::make_shared<BreakpointResolverName>(
+ nullptr, breakpoints, eFunctionNameTypeFull,
+ target.GetLanguage().AsLanguageType(),
+ /*offset=*/0, /*skip_prologue=*/false);
+ resolver->SetMatchLinkageNames(true);
+ BreakpointResolverSP resolver_sp = resolver;
+ BreakpointSP breakpoint = target.CreateBreakpoint(
+ filter, resolver_sp, /*internal=*/true, /*hardware=*/false,
+ /*resolve_indirect_symbols=*/true);
if (!breakpoint)
return LogBeforeReturn<void>("failed to create breakpoint");
diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp
index efea0339d2ef66..8b42f9b24617af 100644
--- a/lldb/source/Symbol/Symtab.cpp
+++ b/lldb/source/Symbol/Symtab.cpp
@@ -810,12 +810,30 @@ Symbol *Symtab::FindSymbolWithType(SymbolType symbol_type,
return nullptr;
}
-void
-Symtab::FindAllSymbolsWithNameAndType(ConstString name,
- SymbolType symbol_type,
- std::vector<uint32_t> &symbol_indexes) {
+void Symtab::FindAllSymbolsWithNameAndType(
+ ConstString name, SymbolType symbol_type,
+ std::vector<uint32_t> &symbol_indexes, bool match_linkage_names) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ if (match_linkage_names) {
+ if (!name)
+ return;
+ for (uint32_t i = 0; i < m_symbols.size(); ++i) {
+ Symbol &symbol = m_symbols[i];
+ if (symbol_type != eSymbolTypeAny && symbol.GetType() != symbol_type)
+ continue;
+ ConstString linkage_name =
+ symbol.GetMangled().GetName(Mangled::ePreferMangled);
+ bool matches = linkage_name == name;
+ if (!matches && symbol.ContainsLinkerAnnotations())
+ matches = m_objfile->StripLinkerSymbolAnnotations(
+ linkage_name.GetStringRef()) == name.GetStringRef();
+ if (matches && !symbol.IsSyntheticWithAutoGeneratedName())
+ symbol_indexes.push_back(i);
+ }
+ return;
+ }
+
// Initialize all of the lookup by name indexes before converting NAME to a
// uniqued string NAME_STR below.
InitNameIndexes();
@@ -1085,9 +1103,31 @@ void Symtab::SymbolIndicesToSymbolContextList(
}
void Symtab::FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
- SymbolContextList &sc_list) {
+ SymbolContextList &sc_list,
+ bool match_linkage_names) {
std::vector<uint32_t> symbol_indexes;
+ if (match_linkage_names) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ std::vector<uint32_t> matching_indexes;
+ FindAllSymbolsWithNameAndType(name, eSymbolTypeAny, matching_indexes,
+ /*match_linkage_names=*/true);
+ for (uint32_t i : matching_indexes) {
+ switch (m_symbols[i].GetType()) {
+ case eSymbolTypeCode:
+ case eSymbolTypeResolver:
+ case eSymbolTypeReExported:
+ case eSymbolTypeAbsolute:
+ symbol_indexes.push_back(i);
+ break;
+ default:
+ break;
+ }
+ }
+ SymbolIndicesToSymbolContextList(symbol_indexes, sc_list);
+ return;
+ }
+
// eFunctionNameTypeAuto should be pre-resolved by a call to
// Module::LookupInfo::LookupInfo()
assert((name_type_mask & eFunctionNameTypeAuto) == 0);
diff --git a/lldb/test/API/lang/BoundsSafety/runtime_detection/Makefile b/lldb/test/API/lang/BoundsSafety/runtime_detection/Makefile
new file mode 100644
index 00000000000000..3e28c7d677ad3a
--- /dev/null
+++ b/lldb/test/API/lang/BoundsSafety/runtime_detection/Makefile
@@ -0,0 +1,16 @@
+C_SOURCES := main.c
+DYLIB_CXX_SOURCES := unrelated.cpp
+DYLIB_NAME := Unrelated
+
+ifeq ($(RUNTIME_LOCATION),main)
+C_SOURCES += runtime.c
+else ifeq ($(RUNTIME_LOCATION),dylib)
+DYLIB_C_SOURCES := library_runtime.c
+else ifeq ($(RUNTIME_LOCATION),cxx)
+DYLIB_CXX_SOURCES += cxx_runtime.cpp
+else ifeq ($(RUNTIME_LOCATION),both)
+C_SOURCES += runtime.c
+DYLIB_CXX_SOURCES += cxx_runtime.cpp
+endif
+
+include Makefile.rules
diff --git a/lldb/test/API/lang/BoundsSafety/runtime_detection/TestBoundsSafetyRuntimeDetection.py b/lldb/test/API/lang/BoundsSafety/runtime_detection/TestBoundsSafetyRuntimeDetection.py
new file mode 100644
index 00000000000000..d2f570f5d659f0
--- /dev/null
+++ b/lldb/test/API/lang/BoundsSafety/runtime_detection/TestBoundsSafetyRuntimeDetection.py
@@ -0,0 +1,163 @@
+import lldb
+from lldbsuite.test.decorators import skipIf, skipIfWindows, skipUnlessDarwin
+from lldbsuite.test.lldbtest import TestBase
+
+
+ at skipIfWindows
+class TestBoundsSafetyRuntimeDetection(TestBase):
+ SHARED_BUILD_TESTCASE = False
+
+ def start(
+ self,
+ runtime_location=None,
+ with_string=False,
+ static=False,
+ without_debug_info=False,
+ late=False,
+ strip_runtime_symbols=False,
+ unrelated_dsym=False,
+ ):
+ flags = []
+ if with_string:
+ flags.append("-DWITH_STRING_TRAP")
+ if static:
+ flags.append("-DSTATIC_RUNTIME")
+ if runtime_location in ("main", "both"):
+ flags.append("-DCALL_MAIN_RUNTIME")
+ if runtime_location in ("dylib", "cxx", "both"):
+ flags.append("-DCALL_LIBRARY_RUNTIME")
+ if late:
+ self.build(
+ dictionary={
+ "DYLIB_ONLY": "YES",
+ "DYLIB_NAME": "Late",
+ "DYLIB_CXX_...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/232694
More information about the lldb-commits
mailing list