diff options
-rw-r--r-- | include/lldb/Symbol/SymbolContext.h | 5 | ||||
-rw-r--r-- | source/Expression/ClangExpressionDeclMap.cpp | 3 | ||||
-rw-r--r-- | source/Symbol/SymbolContext.cpp | 25 | ||||
-rw-r--r-- | test/expression_command/formatters/TestFormatters.py | 32 |
4 files changed, 42 insertions, 23 deletions
diff --git a/include/lldb/Symbol/SymbolContext.h b/include/lldb/Symbol/SymbolContext.h index a5df5e1be..a0b186269 100644 --- a/include/lldb/Symbol/SymbolContext.h +++ b/include/lldb/Symbol/SymbolContext.h @@ -229,8 +229,9 @@ public: /// The number of symbol contexts found. //------------------------------------------------------------------ size_t - FindFunctionsByName (const ConstString &name, - bool include_symbols, + FindFunctionsByName (const ConstString &name, + uint32_t name_type_mask, + bool include_symbols, bool append, SymbolContextList &sc_list) const; diff --git a/source/Expression/ClangExpressionDeclMap.cpp b/source/Expression/ClangExpressionDeclMap.cpp index 368bbe65f..e08985a27 100644 --- a/source/Expression/ClangExpressionDeclMap.cpp +++ b/source/Expression/ClangExpressionDeclMap.cpp @@ -2182,7 +2182,8 @@ ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString { const bool include_symbols = true; const bool append = false; - m_parser_vars->m_sym_ctx.FindFunctionsByName (name, + m_parser_vars->m_sym_ctx.FindFunctionsByName (name, + eFunctionNameTypeBase, include_symbols, append, sc_list); diff --git a/source/Symbol/SymbolContext.cpp b/source/Symbol/SymbolContext.cpp index 4a104b11c..f63509217 100644 --- a/source/Symbol/SymbolContext.cpp +++ b/source/Symbol/SymbolContext.cpp @@ -463,12 +463,14 @@ SymbolContext::FindNamespace (const ConstString &name) const size_t SymbolContext::FindFunctionsByName (const ConstString &name, + uint32_t name_type_mask, bool include_symbols, bool append, SymbolContextList &sc_list) const { if (!append) sc_list.Clear(); + uint32_t old_size = sc_list.GetSize(); if (function != NULL) { @@ -477,12 +479,27 @@ SymbolContext::FindFunctionsByName (const ConstString &name, } if (module_sp) - module_sp->FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, include_symbols, true, sc_list); + module_sp->FindFunctions (name, name_type_mask, include_symbols, true, sc_list); if (target_sp) - target_sp->GetImages().FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, include_symbols, true, sc_list); - - return sc_list.GetSize(); + { + if (!module_sp) + { + target_sp->GetImages().FindFunctions (name, name_type_mask, include_symbols, true, sc_list); + } + else + { + ModuleList &modules = target_sp->GetImages(); + uint32_t num_modules = modules.GetSize(); + for (uint32_t i = 0; i < num_modules; i++) + { + ModuleSP iter_module_sp = modules.GetModuleAtIndex(i); + if (module_sp != iter_module_sp) + iter_module_sp->FindFunctions (name, name_type_mask, include_symbols, true, sc_list); + } + } + } + return sc_list.GetSize() - old_size; } //lldb::VariableSP diff --git a/test/expression_command/formatters/TestFormatters.py b/test/expression_command/formatters/TestFormatters.py index 027191b68..c4b7068fe 100644 --- a/test/expression_command/formatters/TestFormatters.py +++ b/test/expression_command/formatters/TestFormatters.py @@ -56,29 +56,29 @@ class ExprFormattersTestCase(TestBase): self.runCmd("frame variable foo1.b -T") self.runCmd("frame variable foo1.b.b_ref -T") - self.expect("p *(new foo(47))", + self.expect("expression *(new foo(47))", substrs = ['(int) a = 47', '(bar) b = {', '(int) i = 94', '(baz) b = {', '(int) k = 99']) self.runCmd("type summary add -F formatters.foo_SummaryProvider foo") - self.expect("p new int(12)", + self.expect("expression new int(12)", substrs = ['(int *) $', ' = 0x']) self.runCmd("type summary add -s \"${var%pointer} -> ${*var%decimal}\" \"int *\"") - self.expect("p new int(12)", + self.expect("expression new int(12)", substrs = ['(int *) $', '= 0x', ' -> 12']) - self.expect("p foo1.a_ptr", + self.expect("expression foo1.a_ptr", substrs = ['(int *) $', '= 0x', ' -> 13']) - self.expect("p foo1", + self.expect("expression foo1", substrs = ['(foo) $', ' = a = 12, a_ptr = ', ' -> 13, i = 24, i_ptr = ', ' -> 25']) - self.expect("p new foo(47)", + self.expect("expression new foo(47)", substrs = ['(foo *) $', ' a = 47, a_ptr = ', ' -> 48, i = 94, i_ptr = ', ' -> 95']) - self.expect("p foo2", + self.expect("expression foo2", substrs = ['(foo) $', ' = a = 121, a_ptr = ', ' -> 122, i = 242, i_ptr = ', ' -> 243']) object_name = self.res.GetOutput() @@ -88,13 +88,13 @@ class ExprFormattersTestCase(TestBase): self.expect("frame variable foo2", substrs = ['(foo)', 'foo2', ' = a = 121, a_ptr = ', ' -> 122, i = 242, i_ptr = ', ' -> 243']) - self.expect("p $" + object_name, + self.expect("expression $" + object_name, substrs = ['(foo) $', ' = a = 121, a_ptr = ', ' -> 122, i = 242, i_ptr = ', ' -> 243', ', h = 245 , k = 247']) self.runCmd("type summary delete foo") self.runCmd("type synthetic add --python-class foosynth.FooSyntheticProvider foo") - self.expect("p $" + object_name, + self.expect("expression $" + object_name, substrs = ['(foo) $', ' = {', '(int) *i_ptr = 243']) self.runCmd("n") @@ -103,22 +103,22 @@ class ExprFormattersTestCase(TestBase): self.runCmd("type synthetic delete foo") self.runCmd("type summary add -F formatters.foo_SummaryProvider foo") - self.expect("p foo2", + self.expect("expression foo2", substrs = ['(foo) $', ' = a = 7777, a_ptr = ', ' -> 122, i = 242, i_ptr = ', ' -> 8888']) - self.expect("p $" + object_name + '.a', + self.expect("expression $" + object_name + '.a', substrs = ['7777']) - self.expect("p *$" + object_name + '.b.i_ptr', + self.expect("expression *$" + object_name + '.b.i_ptr', substrs = ['8888']) - self.expect("p $" + object_name, + self.expect("expression $" + object_name, substrs = ['(foo) $', ' = a = 121, a_ptr = ', ' -> 122, i = 242, i_ptr = ', ' -> 8888', 'h = 245 , k = 247']) self.runCmd("type summary delete foo") self.runCmd("type synthetic add --python-class foosynth.FooSyntheticProvider foo") - self.expect("p $" + object_name, + self.expect("expression $" + object_name, substrs = ['(foo) $', ' = {', '(int) *i_ptr = 8888']) self.runCmd("n") @@ -126,7 +126,7 @@ class ExprFormattersTestCase(TestBase): self.runCmd("type synthetic delete foo") self.runCmd("type summary add -F formatters.foo_SummaryProvider foo") - self.expect("p $" + object_name, + self.expect("expression $" + object_name, substrs = ['(foo) $', ' = a = 121, a_ptr = ', ' -> 122, i = 242, i_ptr = ', ' -> 8888', 'h = 9999 , k = 247']) process = self.dbg.GetSelectedTarget().GetProcess() @@ -145,7 +145,7 @@ class ExprFormattersTestCase(TestBase): self.expect("frame variable numbers", substrs = ['1','2','3','4','5']) - self.expect("p numbers", + self.expect("expression numbers", substrs = ['1','2','3','4','5']) frozen = frame.EvaluateExpression("&numbers") |