Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h @@ -24,7 +24,7 @@ // Accessors // Accessing information about a DIE - const char *GetMangledName() const; + const char *GetMangledName(bool substitute_name_allowed = true) const; const char *GetPubname() const; Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -200,9 +200,9 @@ return result; } -const char *DWARFDIE::GetMangledName() const { +const char *DWARFDIE::GetMangledName(bool substitute_name_allowed) const { if (IsValid()) - return m_die->GetMangledName(m_cu); + return m_die->GetMangledName(m_cu, substitute_name_allowed); else return nullptr; } Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp @@ -39,10 +39,13 @@ if (!SymbolFileDWARF::DIEInDeclContext(&parent_decl_ctx, die)) return; - // In case of a full match, we just insert everything we find. + // In case of a full match, we insert all non-methods functions and all + // methods with matching mangled name. if (name_type_mask & eFunctionNameTypeFull) { - dies.push_back(die); - return; + if (!die.IsMethod() || die.GetMangledName(false) == name) { + dies.push_back(die); + return; + } } // If looking for ObjC selectors, we need to also check if the name is a Index: lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp =================================================================== --- lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp +++ lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp @@ -10,6 +10,10 @@ // RUN: FileCheck --check-prefix=FULL %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=_ZN3bar3baz3fooEv --find=function --function-flags=full %t | \ +// RUN: FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s +// RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function --function-flags=full %t | \ +// RUN: FileCheck --check-prefix=FULL-MANGLED-METHOD %s // RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \ // RUN: FileCheck --check-prefix=CONTEXT %s // RUN: lldb-test symbols --name=not_there --find=function %t | \ @@ -24,6 +28,10 @@ // RUN: FileCheck --check-prefix=FULL-INDEXED %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=_ZN3bar3baz3fooEv --find=function --function-flags=full %t | \ +// RUN: FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s +// RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function --function-flags=full %t | \ +// RUN: FileCheck --check-prefix=FULL-MANGLED-METHOD %s // RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \ // RUN: FileCheck --check-prefix=CONTEXT %s // RUN: lldb-test symbols --name=not_there --find=function %t | \ @@ -40,6 +48,10 @@ // RUN: FileCheck --check-prefix=FULL-INDEXED %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=_ZN3bar3baz3fooEv --find=function --function-flags=full %t | \ +// RUN: FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s +// RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function --function-flags=full %t | \ +// RUN: FileCheck --check-prefix=FULL-MANGLED-METHOD %s // RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \ // RUN: FileCheck --check-prefix=CONTEXT %s // RUN: lldb-test symbols --name=not_there --find=function %t | \ @@ -58,20 +70,23 @@ // METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi" // METHOD-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv" -// FULL-INDEXED: Found 7 functions: +// FULL-INDEXED: Found 4 functions: // FULL-INDEXED-DAG: name = "foo()", mangled = "_Z3foov" // FULL-INDEXED-DAG: name = "foo(int)", mangled = "_Z3fooi" // FULL-INDEXED-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv" // FULL-INDEXED-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv" -// FULL-INDEXED-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv" -// FULL-INDEXED-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi" -// FULL-INDEXED-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv" // FULL: Found 0 functions: // FULL-MANGLED: Found 1 functions: // FULL-MANGLED-DAG: name = "foo(int)", mangled = "_Z3fooi" +// FULL-MANGLED-NAMESPACE: Found 1 functions: +// FULL-MANGLED-NAMESPACE-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv" + +// FULL-MANGLED-METHOD: Found 1 functions: +// FULL-MANGLED-METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi" + // CONTEXT: Found 1 functions: // CONTEXT-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv"