summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectSource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands/CommandObjectSource.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectSource.cpp53
1 files changed, 26 insertions, 27 deletions
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index 3ac8e91c488..78c8bc81192 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -392,17 +392,18 @@ protected:
// const.
ModuleList module_list =
(m_module_list.GetSize() > 0) ? m_module_list : target->GetImages();
- size_t num_matches =
- module_list.FindFunctions(name, eFunctionNameTypeAuto,
- /*include_symbols=*/false,
- /*include_inlines=*/true,
- /*append=*/true, sc_list_funcs);
+ module_list.FindFunctions(name, eFunctionNameTypeAuto,
+ /*include_symbols=*/false,
+ /*include_inlines=*/true, sc_list_funcs);
+ size_t num_matches = sc_list_funcs.GetSize();
+
if (!num_matches) {
// If we didn't find any functions with that name, try searching for
// symbols that line up exactly with function addresses.
SymbolContextList sc_list_symbols;
- size_t num_symbol_matches = module_list.FindFunctionSymbols(
+ module_list.FindFunctionSymbols(
name, eFunctionNameTypeAuto, sc_list_symbols);
+ size_t num_symbol_matches = sc_list_symbols.GetSize();
for (size_t i = 0; i < num_symbol_matches; i++) {
SymbolContext sc;
sc_list_symbols.GetContextAtIndex(i, sc);
@@ -580,7 +581,8 @@ protected:
FileSpec module_file_spec(m_options.modules[i]);
if (module_file_spec) {
ModuleSpec module_spec(module_file_spec);
- if (target->GetImages().FindModules(module_spec, m_module_list) == 0)
+ target->GetImages().FindModules(module_spec, m_module_list);
+ if (m_module_list.IsEmpty())
result.AppendWarningWithFormat("No module found for '%s'.\n",
m_options.modules[i].c_str());
}
@@ -872,13 +874,11 @@ protected:
// these somewhere, there should probably be a module-filter-list that can be
// passed to the various ModuleList::Find* calls, which would either be a
// vector of string names or a ModuleSpecList.
- size_t FindMatchingFunctions(Target *target, ConstString name,
+ void FindMatchingFunctions(Target *target, ConstString name,
SymbolContextList &sc_list) {
// Displaying the source for a symbol:
bool include_inlines = true;
- bool append = true;
bool include_symbols = false;
- size_t num_matches = 0;
if (m_options.num_lines == 0)
m_options.num_lines = 10;
@@ -892,22 +892,20 @@ protected:
ModuleSpec module_spec(module_file_spec);
matching_modules.Clear();
target->GetImages().FindModules(module_spec, matching_modules);
- num_matches += matching_modules.FindFunctions(
+ matching_modules.FindFunctions(
name, eFunctionNameTypeAuto, include_symbols, include_inlines,
- append, sc_list);
+ sc_list);
}
}
} else {
- num_matches = target->GetImages().FindFunctions(
- name, eFunctionNameTypeAuto, include_symbols, include_inlines, append,
- sc_list);
+ target->GetImages().FindFunctions(name, eFunctionNameTypeAuto,
+ include_symbols, include_inlines,
+ sc_list);
}
- return num_matches;
}
- size_t FindMatchingFunctionSymbols(Target *target, ConstString name,
- SymbolContextList &sc_list) {
- size_t num_matches = 0;
+ void FindMatchingFunctionSymbols(Target *target, ConstString name,
+ SymbolContextList &sc_list) {
const size_t num_modules = m_options.modules.size();
if (num_modules > 0) {
ModuleList matching_modules;
@@ -917,15 +915,14 @@ protected:
ModuleSpec module_spec(module_file_spec);
matching_modules.Clear();
target->GetImages().FindModules(module_spec, matching_modules);
- num_matches += matching_modules.FindFunctionSymbols(
- name, eFunctionNameTypeAuto, sc_list);
+ matching_modules.FindFunctionSymbols(name, eFunctionNameTypeAuto,
+ sc_list);
}
}
} else {
- num_matches = target->GetImages().FindFunctionSymbols(
- name, eFunctionNameTypeAuto, sc_list);
+ target->GetImages().FindFunctionSymbols(name, eFunctionNameTypeAuto,
+ sc_list);
}
- return num_matches;
}
bool DoExecute(Args &command, CommandReturnObject &result) override {
@@ -945,13 +942,15 @@ protected:
ConstString name(m_options.symbol_name.c_str());
// Displaying the source for a symbol. Search for function named name.
- size_t num_matches = FindMatchingFunctions(target, name, sc_list);
+ FindMatchingFunctions(target, name, sc_list);
+ size_t num_matches = sc_list.GetSize();
if (!num_matches) {
// If we didn't find any functions with that name, try searching for
// symbols that line up exactly with function addresses.
SymbolContextList sc_list_symbols;
- size_t num_symbol_matches =
- FindMatchingFunctionSymbols(target, name, sc_list_symbols);
+ FindMatchingFunctionSymbols(target, name, sc_list_symbols);
+ size_t num_symbol_matches =sc_list_symbols.GetSize();
+
for (size_t i = 0; i < num_symbol_matches; i++) {
SymbolContext sc;
sc_list_symbols.GetContextAtIndex(i, sc);
OpenPOWER on IntegriCloud