[Lldb-commits] [lldb] c020be1 - [lldb] Use a struct to pass function search options to Module::FindFunction
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 5 10:18:33 PDT 2021
Author: Jonas Devlieghere
Date: 2021-08-05T10:18:14-07:00
New Revision: c020be17ce0a43c32554585e1075627769f364f3
URL: https://github.com/llvm/llvm-project/commit/c020be17ce0a43c32554585e1075627769f364f3
DIFF: https://github.com/llvm/llvm-project/commit/c020be17ce0a43c32554585e1075627769f364f3.diff
LOG: [lldb] Use a struct to pass function search options to Module::FindFunction
Rather than passing two booleans around, which is especially error prone
with them being next to each other, use a struct with named fields
instead.
Differential revision: https://reviews.llvm.org/D107295
Added:
Modified:
lldb/include/lldb/Core/Module.h
lldb/include/lldb/Core/ModuleList.h
lldb/source/API/SBModule.cpp
lldb/source/API/SBTarget.cpp
lldb/source/Breakpoint/BreakpointResolverName.cpp
lldb/source/Commands/CommandCompletions.cpp
lldb/source/Commands/CommandObjectDisassemble.cpp
lldb/source/Commands/CommandObjectSource.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Core/Module.cpp
lldb/source/Core/ModuleList.cpp
lldb/source/Core/SourceManager.cpp
lldb/source/Expression/IRExecutionUnit.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index dd7100c4616c3..767f2d232947c 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -57,6 +57,15 @@ class TypeList;
class TypeMap;
class VariableList;
+/// Options used by Module::FindFunctions. This cannot be a nested class
+/// because it must be forward-declared in ModuleList.h.
+struct ModuleFunctionSearchOptions {
+ /// Include the symbol table.
+ bool include_symbols = false;
+ /// Include inlined functions.
+ bool include_inlines = false;
+};
+
/// \class Module Module.h "lldb/Core/Module.h"
/// A class that describes an executable image and its associated
/// object and symbol files.
@@ -304,8 +313,9 @@ class Module : public std::enable_shared_from_this<Module>,
/// matches.
void FindFunctions(ConstString name,
const CompilerDeclContext &parent_decl_ctx,
- lldb::FunctionNameType name_type_mask, bool symbols_ok,
- bool inlines_ok, SymbolContextList &sc_list);
+ lldb::FunctionNameType name_type_mask,
+ const ModuleFunctionSearchOptions &options,
+ SymbolContextList &sc_list);
/// Find functions by name.
///
@@ -319,8 +329,9 @@ class Module : public std::enable_shared_from_this<Module>,
/// \param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
- void FindFunctions(const RegularExpression ®ex, bool symbols_ok,
- bool inlines_ok, SymbolContextList &sc_list);
+ void FindFunctions(const RegularExpression ®ex,
+ const ModuleFunctionSearchOptions &options,
+ SymbolContextList &sc_list);
/// Find addresses by file/line
///
diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h
index 07dddd18357b7..39d4a63dbf464 100644
--- a/lldb/include/lldb/Core/ModuleList.h
+++ b/lldb/include/lldb/Core/ModuleList.h
@@ -45,6 +45,7 @@ class Target;
class TypeList;
class UUID;
class VariableList;
+struct ModuleFunctionSearchOptions;
class ModuleListProperties : public Properties {
mutable llvm::sys::RWMutex m_symlink_paths_mutex;
@@ -252,7 +253,7 @@ class ModuleList {
/// \see Module::FindFunctions ()
void FindFunctions(ConstString name, lldb::FunctionNameType name_type_mask,
- bool include_symbols, bool include_inlines,
+ const ModuleFunctionSearchOptions &options,
SymbolContextList &sc_list) const;
/// \see Module::FindFunctionSymbols ()
@@ -261,8 +262,9 @@ class ModuleList {
SymbolContextList &sc_list);
/// \see Module::FindFunctions ()
- void FindFunctions(const RegularExpression &name, bool include_symbols,
- bool include_inlines, SymbolContextList &sc_list);
+ void FindFunctions(const RegularExpression &name,
+ const ModuleFunctionSearchOptions &options,
+ SymbolContextList &sc_list);
/// Find global and static variables by name.
///
diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp
index b5b9fe16aa63f..710ee8551bd62 100644
--- a/lldb/source/API/SBModule.cpp
+++ b/lldb/source/API/SBModule.cpp
@@ -397,11 +397,13 @@ lldb::SBSymbolContextList SBModule::FindFunctions(const char *name,
lldb::SBSymbolContextList sb_sc_list;
ModuleSP module_sp(GetSP());
if (name && module_sp) {
- const bool symbols_ok = true;
- const bool inlines_ok = true;
+
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = true;
+ function_options.include_inlines = true;
FunctionNameType type = static_cast<FunctionNameType>(name_type_mask);
module_sp->FindFunctions(ConstString(name), CompilerDeclContext(), type,
- symbols_ok, inlines_ok, *sb_sc_list);
+ function_options, *sb_sc_list);
}
return LLDB_RECORD_RESULT(sb_sc_list);
}
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 6f0633288a2b0..8829a55d57a49 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1831,11 +1831,13 @@ lldb::SBSymbolContextList SBTarget::FindFunctions(const char *name,
if (!target_sp)
return LLDB_RECORD_RESULT(sb_sc_list);
- const bool symbols_ok = true;
- const bool inlines_ok = true;
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = true;
+ function_options.include_inlines = true;
+
FunctionNameType mask = static_cast<FunctionNameType>(name_type_mask);
- target_sp->GetImages().FindFunctions(ConstString(name), mask, symbols_ok,
- inlines_ok, *sb_sc_list);
+ target_sp->GetImages().FindFunctions(ConstString(name), mask,
+ function_options, *sb_sc_list);
return LLDB_RECORD_RESULT(sb_sc_list);
}
@@ -1851,20 +1853,25 @@ lldb::SBSymbolContextList SBTarget::FindGlobalFunctions(const char *name,
llvm::StringRef name_ref(name);
TargetSP target_sp(GetSP());
if (target_sp) {
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = true;
+ function_options.include_inlines = true;
+
std::string regexstr;
switch (matchtype) {
case eMatchTypeRegex:
- target_sp->GetImages().FindFunctions(RegularExpression(name_ref), true,
- true, *sb_sc_list);
+ target_sp->GetImages().FindFunctions(RegularExpression(name_ref),
+ function_options, *sb_sc_list);
break;
case eMatchTypeStartsWith:
regexstr = llvm::Regex::escape(name) + ".*";
- target_sp->GetImages().FindFunctions(RegularExpression(regexstr), true,
- true, *sb_sc_list);
+ target_sp->GetImages().FindFunctions(RegularExpression(regexstr),
+ function_options, *sb_sc_list);
break;
default:
- target_sp->GetImages().FindFunctions(
- ConstString(name), eFunctionNameTypeAny, true, true, *sb_sc_list);
+ target_sp->GetImages().FindFunctions(ConstString(name),
+ eFunctionNameTypeAny,
+ function_options, *sb_sc_list);
break;
}
}
diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp
index 121ac5690d70f..49087b39944d8 100644
--- a/lldb/source/Breakpoint/BreakpointResolverName.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp
@@ -264,8 +264,10 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter,
bool filter_by_cu =
(filter.GetFilterRequiredItems() & eSymbolContextCompUnit) != 0;
bool filter_by_language = (m_language != eLanguageTypeUnknown);
- const bool include_symbols = !filter_by_cu;
- const bool include_inlines = true;
+
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = !filter_by_cu;
+ function_options.include_inlines = true;
switch (m_match_type) {
case Breakpoint::Exact:
@@ -274,8 +276,7 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter,
const size_t start_func_idx = func_list.GetSize();
context.module_sp->FindFunctions(
lookup.GetLookupName(), CompilerDeclContext(),
- lookup.GetNameTypeMask(), include_symbols, include_inlines,
- func_list);
+ lookup.GetNameTypeMask(), function_options, func_list);
const size_t end_func_idx = func_list.GetSize();
@@ -286,10 +287,7 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter,
break;
case Breakpoint::Regexp:
if (context.module_sp) {
- context.module_sp->FindFunctions(
- m_regex,
- !filter_by_cu, // include symbols only if we aren't filtering by CU
- include_inlines, func_list);
+ context.module_sp->FindFunctions(m_regex, function_options, func_list);
}
break;
case Breakpoint::Glob:
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp
index 55018cef57d4e..191c25f5e6771 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -213,10 +213,10 @@ class SymbolCompleter : public Completer {
Address *addr) override {
if (context.module_sp) {
SymbolContextList sc_list;
- const bool include_symbols = true;
- const bool include_inlines = true;
- context.module_sp->FindFunctions(m_regex, include_symbols,
- include_inlines, sc_list);
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = true;
+ function_options.include_inlines = true;
+ context.module_sp->FindFunctions(m_regex, function_options, sc_list);
SymbolContext sc;
// Now add the functions & symbols to the list - only add if unique:
diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 5e73fb8218ab9..02a16622c76b9 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -322,13 +322,15 @@ CommandObjectDisassemble::GetCurrentLineRanges() {
llvm::Expected<std::vector<AddressRange>>
CommandObjectDisassemble::GetNameRanges(CommandReturnObject &result) {
ConstString name(m_options.func_name.c_str());
- const bool include_symbols = true;
- const bool include_inlines = true;
+
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = true;
+ function_options.include_inlines = true;
// Find functions matching the given name.
SymbolContextList sc_list;
- GetSelectedTarget().GetImages().FindFunctions(
- name, eFunctionNameTypeAuto, include_symbols, include_inlines, sc_list);
+ GetSelectedTarget().GetImages().FindFunctions(name, eFunctionNameTypeAuto,
+ function_options, sc_list);
std::vector<AddressRange> ranges;
llvm::Error range_errs = llvm::Error::success();
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index 7a0338e35bc7f..fb33f41b8ef96 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -374,13 +374,16 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
Target *target = m_exe_ctx.GetTargetPtr();
uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = false;
+ function_options.include_inlines = true;
+
// Note: module_list can't be const& because FindFunctionSymbols isn't
// const.
ModuleList module_list =
(m_module_list.GetSize() > 0) ? m_module_list : target->GetImages();
- module_list.FindFunctions(name, eFunctionNameTypeAuto,
- /*include_symbols=*/false,
- /*include_inlines=*/true, sc_list_funcs);
+ module_list.FindFunctions(name, eFunctionNameTypeAuto, function_options,
+ sc_list_funcs);
size_t num_matches = sc_list_funcs.GetSize();
if (!num_matches) {
@@ -874,12 +877,13 @@ class CommandObjectSourceList : public CommandObjectParsed {
void FindMatchingFunctions(Target *target, ConstString name,
SymbolContextList &sc_list) {
// Displaying the source for a symbol:
- bool include_inlines = true;
- bool include_symbols = false;
-
if (m_options.num_lines == 0)
m_options.num_lines = 10;
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = true;
+ function_options.include_inlines = false;
+
const size_t num_modules = m_options.modules.size();
if (num_modules > 0) {
ModuleList matching_modules;
@@ -889,15 +893,14 @@ class CommandObjectSourceList : public CommandObjectParsed {
ModuleSpec module_spec(module_file_spec);
matching_modules.Clear();
target->GetImages().FindModules(module_spec, matching_modules);
+
matching_modules.FindFunctions(name, eFunctionNameTypeAuto,
- include_symbols, include_inlines,
- sc_list);
+ function_options, sc_list);
}
}
} else {
target->GetImages().FindFunctions(name, eFunctionNameTypeAuto,
- include_symbols, include_inlines,
- sc_list);
+ function_options, sc_list);
}
}
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index b25514b1ffbc9..ccac874faeef2 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -1570,20 +1570,18 @@ static void DumpSymbolContextList(ExecutionContextScope *exe_scope,
static size_t LookupFunctionInModule(CommandInterpreter &interpreter,
Stream &strm, Module *module,
const char *name, bool name_is_regex,
- bool include_inlines, bool include_symbols,
+ const ModuleFunctionSearchOptions &options,
bool verbose) {
if (module && name && name[0]) {
SymbolContextList sc_list;
size_t num_matches = 0;
if (name_is_regex) {
RegularExpression function_name_regex((llvm::StringRef(name)));
- module->FindFunctions(function_name_regex, include_symbols,
- include_inlines, sc_list);
+ module->FindFunctions(function_name_regex, options, sc_list);
} else {
ConstString function_name(name);
module->FindFunctions(function_name, CompilerDeclContext(),
- eFunctionNameTypeAuto, include_symbols,
- include_inlines, sc_list);
+ eFunctionNameTypeAuto, options, sc_list);
}
num_matches = sc_list.GetSize();
if (num_matches) {
@@ -3281,8 +3279,11 @@ class CommandObjectTargetModulesShowUnwind : public CommandObjectParsed {
if (m_options.m_type == eLookupTypeFunctionOrSymbol) {
ConstString function_name(m_options.m_str.c_str());
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = true;
+ function_options.include_inlines = false;
target->GetImages().FindFunctions(function_name, eFunctionNameTypeAuto,
- true, false, sc_list);
+ function_options, sc_list);
} else if (m_options.m_type == eLookupTypeAddress && target) {
Address addr;
if (target->GetSectionLoadList().ResolveLoadAddress(m_options.m_addr,
@@ -3753,13 +3754,15 @@ class CommandObjectTargetModulesLookup : public CommandObjectParsed {
case eLookupTypeFunctionOrSymbol:
case eLookupTypeFunction:
if (!m_options.m_str.empty()) {
- if (LookupFunctionInModule(
- m_interpreter, result.GetOutputStream(), module,
- m_options.m_str.c_str(), m_options.m_use_regex,
- m_options.m_include_inlines,
- m_options.m_type ==
- eLookupTypeFunctionOrSymbol, // include symbols
- m_options.m_verbose)) {
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols =
+ m_options.m_type == eLookupTypeFunctionOrSymbol;
+ function_options.include_inlines = m_options.m_include_inlines;
+
+ if (LookupFunctionInModule(m_interpreter, result.GetOutputStream(),
+ module, m_options.m_str.c_str(),
+ m_options.m_use_regex, function_options,
+ m_options.m_verbose)) {
result.SetStatus(eReturnStatusSuccessFinishResult);
return true;
}
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 19c97be150660..c7538db7dd240 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -796,7 +796,7 @@ void Module::LookupInfo::Prune(SymbolContextList &sc_list,
void Module::FindFunctions(ConstString name,
const CompilerDeclContext &parent_decl_ctx,
FunctionNameType name_type_mask,
- bool include_symbols, bool include_inlines,
+ const ModuleFunctionSearchOptions &options,
SymbolContextList &sc_list) {
const size_t old_size = sc_list.GetSize();
@@ -808,12 +808,12 @@ void Module::FindFunctions(ConstString name,
if (symbols) {
symbols->FindFunctions(lookup_info.GetLookupName(), parent_decl_ctx,
- lookup_info.GetNameTypeMask(), include_inlines,
- sc_list);
+ lookup_info.GetNameTypeMask(),
+ options.include_inlines, sc_list);
// Now check our symbol table for symbols that are code symbols if
// requested
- if (include_symbols) {
+ if (options.include_symbols) {
Symtab *symtab = symbols->GetSymtab();
if (symtab)
symtab->FindFunctionSymbols(lookup_info.GetLookupName(),
@@ -828,11 +828,11 @@ void Module::FindFunctions(ConstString name,
} else {
if (symbols) {
symbols->FindFunctions(name, parent_decl_ctx, name_type_mask,
- include_inlines, sc_list);
+ options.include_inlines, sc_list);
// Now check our symbol table for symbols that are code symbols if
// requested
- if (include_symbols) {
+ if (options.include_symbols) {
Symtab *symtab = symbols->GetSymtab();
if (symtab)
symtab->FindFunctionSymbols(name, name_type_mask, sc_list);
@@ -841,17 +841,17 @@ void Module::FindFunctions(ConstString name,
}
}
-void Module::FindFunctions(const RegularExpression ®ex, bool include_symbols,
- bool include_inlines,
+void Module::FindFunctions(const RegularExpression ®ex,
+ const ModuleFunctionSearchOptions &options,
SymbolContextList &sc_list) {
const size_t start_size = sc_list.GetSize();
if (SymbolFile *symbols = GetSymbolFile()) {
- symbols->FindFunctions(regex, include_inlines, sc_list);
+ symbols->FindFunctions(regex, options.include_inlines, sc_list);
// Now check our symbol table for symbols that are code symbols if
// requested
- if (include_symbols) {
+ if (options.include_symbols) {
Symtab *symtab = symbols->GetSymtab();
if (symtab) {
std::vector<uint32_t> symbol_indexes;
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 56bc4c72d8e9c..44afed7fcf0de 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -364,7 +364,7 @@ ModuleSP ModuleList::GetModuleAtIndexUnlocked(size_t idx) const {
void ModuleList::FindFunctions(ConstString name,
FunctionNameType name_type_mask,
- bool include_symbols, bool include_inlines,
+ const ModuleFunctionSearchOptions &options,
SymbolContextList &sc_list) const {
const size_t old_size = sc_list.GetSize();
@@ -375,8 +375,7 @@ void ModuleList::FindFunctions(ConstString name,
collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos) {
(*pos)->FindFunctions(lookup_info.GetLookupName(), CompilerDeclContext(),
- lookup_info.GetNameTypeMask(), include_symbols,
- include_inlines, sc_list);
+ lookup_info.GetNameTypeMask(), options, sc_list);
}
const size_t new_size = sc_list.GetSize();
@@ -388,7 +387,7 @@ void ModuleList::FindFunctions(ConstString name,
collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos) {
(*pos)->FindFunctions(name, CompilerDeclContext(), name_type_mask,
- include_symbols, include_inlines, sc_list);
+ options, sc_list);
}
}
}
@@ -422,12 +421,12 @@ void ModuleList::FindFunctionSymbols(ConstString name,
}
void ModuleList::FindFunctions(const RegularExpression &name,
- bool include_symbols, bool include_inlines,
+ const ModuleFunctionSearchOptions &options,
SymbolContextList &sc_list) {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos) {
- (*pos)->FindFunctions(name, include_symbols, include_inlines, sc_list);
+ (*pos)->FindFunctions(name, options, sc_list);
}
}
diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp
index 9c1112979c544..effba485f0262 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -339,11 +339,14 @@ bool SourceManager::GetDefaultFileAndLine(FileSpec &file_spec, uint32_t &line) {
if (executable_ptr) {
SymbolContextList sc_list;
ConstString main_name("main");
- bool symbols_okay = false; // Force it to be a debug symbol.
- bool inlines_okay = true;
+
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols =
+ false; // Force it to be a debug symbol.
+ function_options.include_inlines = true;
executable_ptr->FindFunctions(main_name, CompilerDeclContext(),
- lldb::eFunctionNameTypeBase, inlines_okay,
- symbols_okay, sc_list);
+ lldb::eFunctionNameTypeBase,
+ function_options, sc_list);
size_t num_matches = sc_list.GetSize();
for (size_t idx = 0; idx < num_matches; idx++) {
SymbolContext sc;
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index 63184ba477a67..449d5569b371e 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -854,11 +854,13 @@ lldb::addr_t IRExecutionUnit::FindInSymbols(
return false;
};
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = true;
+ function_options.include_inlines = false;
+
if (sc.module_sp) {
sc.module_sp->FindFunctions(spec.name, CompilerDeclContext(), spec.mask,
- true, // include_symbols
- false, // include_inlines
- sc_list);
+ function_options, sc_list);
}
lldb::addr_t load_address = LLDB_INVALID_ADDRESS;
@@ -871,9 +873,7 @@ lldb::addr_t IRExecutionUnit::FindInSymbols(
if (sc_list.GetSize() == 0 && sc.target_sp) {
sc.target_sp->GetImages().FindFunctions(spec.name, spec.mask,
- true, // include_symbols
- false, // include_inlines
- sc_list);
+ function_options, sc_list);
}
if (get_external_load_address(load_address, sc_list, sc)) {
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index b43423707ae1a..fad2f3f1a8638 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -974,8 +974,9 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
interface_decl->getName(), selector_name);
SymbolContextList sc_list;
- const bool include_symbols = false;
- const bool include_inlines = false;
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = false;
+ function_options.include_inlines = false;
std::string interface_name = interface_decl->getNameAsString();
@@ -986,9 +987,9 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
ConstString instance_method_name(ms.GetString());
sc_list.Clear();
- m_target->GetImages().FindFunctions(
- instance_method_name, lldb::eFunctionNameTypeFull, include_symbols,
- include_inlines, sc_list);
+ m_target->GetImages().FindFunctions(instance_method_name,
+ lldb::eFunctionNameTypeFull,
+ function_options, sc_list);
if (sc_list.GetSize())
break;
@@ -999,9 +1000,9 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
ConstString class_method_name(ms.GetString());
sc_list.Clear();
- m_target->GetImages().FindFunctions(
- class_method_name, lldb::eFunctionNameTypeFull, include_symbols,
- include_inlines, sc_list);
+ m_target->GetImages().FindFunctions(class_method_name,
+ lldb::eFunctionNameTypeFull,
+ function_options, sc_list);
if (sc_list.GetSize())
break;
@@ -1012,9 +1013,9 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
SymbolContextList candidate_sc_list;
- m_target->GetImages().FindFunctions(
- selector_name, lldb::eFunctionNameTypeSelector, include_symbols,
- include_inlines, candidate_sc_list);
+ m_target->GetImages().FindFunctions(selector_name,
+ lldb::eFunctionNameTypeSelector,
+ function_options, candidate_sc_list);
for (uint32_t ci = 0, ce = candidate_sc_list.GetSize(); ci != ce; ++ci) {
SymbolContext candidate_sc;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 731b81c61a6f8..68ae665083930 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1220,22 +1220,25 @@ void ClangExpressionDeclMap::LookupFunction(
}
}
- const bool include_inlines = false;
SymbolContextList sc_list;
if (namespace_decl && module_sp) {
- const bool include_symbols = false;
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_inlines = false;
+ function_options.include_symbols = false;
module_sp->FindFunctions(name, namespace_decl, eFunctionNameTypeBase,
- include_symbols, include_inlines, sc_list);
+ function_options, sc_list);
} else if (target && !namespace_decl) {
- const bool include_symbols = true;
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_inlines = false;
+ function_options.include_symbols = true;
// TODO Fix FindFunctions so that it doesn't return
// instance methods for eFunctionNameTypeBase.
target->GetImages().FindFunctions(
- name, eFunctionNameTypeFull | eFunctionNameTypeBase, include_symbols,
- include_inlines, sc_list);
+ name, eFunctionNameTypeFull | eFunctionNameTypeBase, function_options,
+ sc_list);
}
// If we found more than one function, see if we can use the frame's decl
diff --git a/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp b/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
index 0f331933f2ea2..5091f68a9acfe 100644
--- a/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
+++ b/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
@@ -8,12 +8,13 @@
#include "InferiorCallPOSIX.h"
#include "lldb/Core/Address.h"
+#include "lldb/Core/Module.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Expression/DiagnosticManager.h"
#include "lldb/Host/Config.h"
-#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
@@ -41,12 +42,13 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr,
if (thread == nullptr)
return false;
- const bool include_symbols = true;
- const bool include_inlines = false;
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = true;
+ function_options.include_inlines = false;
+
SymbolContextList sc_list;
process->GetTarget().GetImages().FindFunctions(
- ConstString("mmap"), eFunctionNameTypeFull, include_symbols,
- include_inlines, sc_list);
+ ConstString("mmap"), eFunctionNameTypeFull, function_options, sc_list);
const uint32_t count = sc_list.GetSize();
if (count > 0) {
SymbolContext sc;
@@ -135,12 +137,13 @@ bool lldb_private::InferiorCallMunmap(Process *process, addr_t addr,
if (thread == nullptr)
return false;
- const bool include_symbols = true;
- const bool include_inlines = false;
+ ModuleFunctionSearchOptions function_options;
+ function_options.include_symbols = true;
+ function_options.include_inlines = false;
+
SymbolContextList sc_list;
process->GetTarget().GetImages().FindFunctions(
- ConstString("munmap"), eFunctionNameTypeFull, include_symbols,
- include_inlines, sc_list);
+ ConstString("munmap"), eFunctionNameTypeFull, function_options, sc_list);
const uint32_t count = sc_list.GetSize();
if (count > 0) {
SymbolContext sc;
More information about the lldb-commits
mailing list