From a705cf1acbe94498f7fcca4e89be6d4820271227 Mon Sep 17 00:00:00 2001 From: Levon Ter-Grigoryan Date: Tue, 14 Jan 2020 14:33:43 +0100 Subject: Expression eval lookup speedup by not returning methods in ManualDWARFIndex::GetFunctions Summary: This change is connected with https://reviews.llvm.org/D69843 In large codebases, we sometimes see Module::FindFunctions (when called from ClangExpressionDeclMap::FindExternalVisibleDecls) returning huge amounts of functions. In current fix I trying to return only function_fullnames from ManualDWARFIndex::GetFunctions when eFunctionNameTypeFull is passed as argument. Reviewers: labath, jarin, aprantl Reviewed By: labath Subscribers: shafik, clayborg, teemperor, arphaman, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70846 --- .../lldbsuite/test/lang/cpp/printf/TestPrintf.py | 5 +++-- .../Clang/ClangExpressionDeclMap.cpp | 6 +++--- .../Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp | 2 -- .../Shell/SymbolFile/DWARF/find-basic-function.cpp | 20 +++++++++++--------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/printf/TestPrintf.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/printf/TestPrintf.py index 3dfe4f29d18..10e400f4e72 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/printf/TestPrintf.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/printf/TestPrintf.py @@ -1,7 +1,8 @@ -from lldbsuite.test import lldbinline +from lldbsuite.test import lldbinline, lldbplatformutil from lldbsuite.test import decorators lldbinline.MakeInlineTest( __file__, globals(), [ decorators.expectedFailureAll( - bugnumber="llvm.org/PR36715")]) + bugnumber="llvm.org/PR36715", + oslist=lldbplatformutil.getDarwinOSTriples()+['windows'])]) diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp index a302a73cafc..bf3023be5f6 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -1254,9 +1254,9 @@ void ClangExpressionDeclMap::LookupFunction(NameSearchContext &context, // TODO Fix FindFunctions so that it doesn't return // instance methods for eFunctionNameTypeBase. - target->GetImages().FindFunctions(name, eFunctionNameTypeFull, - include_symbols, include_inlines, - sc_list); + target->GetImages().FindFunctions( + name, eFunctionNameTypeFull | eFunctionNameTypeBase, include_symbols, + include_inlines, sc_list); } // If we found more than one function, see if we can use the frame's decl diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp index aff8b5d8c15..1e5927bd14f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -401,8 +401,6 @@ void ManualDWARFIndex::GetFunctions(ConstString name, SymbolFileDWARF &dwarf, if (name_type_mask & eFunctionNameTypeFull) { DIEArray offsets; - m_set.function_basenames.Find(name, offsets); - m_set.function_methods.Find(name, offsets); m_set.function_fullnames.Find(name, offsets); for (const DIERef &die_ref: offsets) { DWARFDIE die = dwarf.GetDIE(die_ref); diff --git a/lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp b/lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp index 3d175f63e04..a05b0685a3d 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp @@ -21,7 +21,7 @@ // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \ // RUN: FileCheck --check-prefix=METHOD %s // RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t | \ -// RUN: FileCheck --check-prefix=FULL %s +// RUN: FileCheck --check-prefix=FULL-APPLE %s // RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \ // RUN: FileCheck --check-prefix=FULL-MANGLED %s // RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \ @@ -55,14 +55,16 @@ // METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi" // METHOD-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv" -// FULL: Found 7 functions: -// FULL-DAG: name = "foo()", mangled = "_Z3foov" -// FULL-DAG: name = "foo(int)", mangled = "_Z3fooi" -// FULL-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv" -// FULL-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv" -// FULL-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv" -// FULL-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi" -// FULL-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv" +// FULL-APPLE: Found 7 functions: +// FULL-APPLE-DAG: name = "foo()", mangled = "_Z3foov" +// FULL-APPLE-DAG: name = "foo(int)", mangled = "_Z3fooi" +// FULL-APPLE-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv" +// FULL-APPLE-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv" +// FULL-APPLE-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv" +// FULL-APPLE-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi" +// FULL-APPLE-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv" + +// FULL: Found 0 functions: // FULL-MANGLED: Found 1 functions: // FULL-MANGLED-DAG: name = "foo(int)", mangled = "_Z3fooi" -- cgit v1.2.1