Skip to content

Commit f968bd7

Browse files
Jaroslav SevcikTeemperor
authored andcommitted
Reland "[lldb/DWARF] Only match mangled name in full-name function lookup (with accelerators)"
Summary: In the spirit of https://reviews.llvm.org/D70846, we only return functions with matching mangled name from Apple/DebugNamesDWARFIndex::GetFunction if eFunctionNameTypeFull is requested. This speeds up lookup in the presence of large amount of class methods of the same name (a typical examples would be constructors of templates with many instantiations or overloaded operators). Reviewers: labath, teemperor Reviewed By: labath, teemperor Subscribers: aprantl, arphaman, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D73191
1 parent 7f16393 commit f968bd7

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ bool DWARFIndex::ProcessFunctionDIE(
4141
return true;
4242

4343
// In case of a full match, we just insert everything we find.
44-
if (name_type_mask & eFunctionNameTypeFull)
44+
if (name_type_mask & eFunctionNameTypeFull && die.GetMangledName() == name)
4545
return callback(die);
4646

4747
// If looking for ObjC selectors, we need to also check if the name is a

lldb/test/API/lang/cpp/printf/TestPrintf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
__file__, globals(), [
66
decorators.expectedFailureAll(
77
bugnumber="llvm.org/PR36715",
8-
oslist=lldbplatformutil.getDarwinOSTriples()+['windows'])])
8+
oslist=['windows'])])

lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
// RUN: FileCheck --check-prefix=FULL %s
1111
// RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \
1212
// RUN: FileCheck --check-prefix=FULL-MANGLED %s
13+
// RUN: lldb-test symbols --name=_ZN3bar3baz3fooEv --find=function --function-flags=full %t | \
14+
// RUN: FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s
15+
// RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function --function-flags=full %t | \
16+
// RUN: FileCheck --check-prefix=FULL-MANGLED-METHOD %s
1317
// RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \
1418
// RUN: FileCheck --check-prefix=CONTEXT %s
1519
// RUN: lldb-test symbols --name=not_there --find=function %t | \
@@ -21,9 +25,13 @@
2125
// RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \
2226
// RUN: FileCheck --check-prefix=METHOD %s
2327
// RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t | \
24-
// RUN: FileCheck --check-prefix=FULL-INDEXED %s
28+
// RUN: FileCheck --check-prefix=FULL %s
2529
// RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \
2630
// RUN: FileCheck --check-prefix=FULL-MANGLED %s
31+
// RUN: lldb-test symbols --name=_ZN3bar3baz3fooEv --find=function --function-flags=full %t | \
32+
// RUN: FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s
33+
// RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function --function-flags=full %t | \
34+
// RUN: FileCheck --check-prefix=FULL-MANGLED-METHOD %s
2735
// RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \
2836
// RUN: FileCheck --check-prefix=CONTEXT %s
2937
// RUN: lldb-test symbols --name=not_there --find=function %t | \
@@ -37,9 +45,13 @@
3745
// RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \
3846
// RUN: FileCheck --check-prefix=METHOD %s
3947
// RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t | \
40-
// RUN: FileCheck --check-prefix=FULL-INDEXED %s
48+
// RUN: FileCheck --check-prefix=FULL %s
4149
// RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \
4250
// RUN: FileCheck --check-prefix=FULL-MANGLED %s
51+
// RUN: lldb-test symbols --name=_ZN3bar3baz3fooEv --find=function --function-flags=full %t | \
52+
// RUN: FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s
53+
// RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function --function-flags=full %t | \
54+
// RUN: FileCheck --check-prefix=FULL-MANGLED-METHOD %s
4355
// RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \
4456
// RUN: FileCheck --check-prefix=CONTEXT %s
4557
// RUN: lldb-test symbols --name=not_there --find=function %t | \
@@ -58,20 +70,17 @@
5870
// METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
5971
// METHOD-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv"
6072

61-
// FULL-INDEXED: Found 7 functions:
62-
// FULL-INDEXED-DAG: name = "foo()", mangled = "_Z3foov"
63-
// FULL-INDEXED-DAG: name = "foo(int)", mangled = "_Z3fooi"
64-
// FULL-INDEXED-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv"
65-
// FULL-INDEXED-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv"
66-
// FULL-INDEXED-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv"
67-
// FULL-INDEXED-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
68-
// FULL-INDEXED-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv"
69-
7073
// FULL: Found 0 functions:
7174

7275
// FULL-MANGLED: Found 1 functions:
7376
// FULL-MANGLED-DAG: name = "foo(int)", mangled = "_Z3fooi"
7477

78+
// FULL-MANGLED-NAMESPACE: Found 1 functions:
79+
// FULL-MANGLED-NAMESPACE-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv"
80+
81+
// FULL-MANGLED-METHOD: Found 1 functions:
82+
// FULL-MANGLED-METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
83+
7584
// CONTEXT: Found 1 functions:
7685
// CONTEXT-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv"
7786

0 commit comments

Comments
 (0)