diff options
author | Robert Flack <flackr@gmail.com> | 2015-05-15 18:59:59 +0000 |
---|---|---|
committer | Robert Flack <flackr@gmail.com> | 2015-05-15 18:59:59 +0000 |
commit | eb83fabfa03be6e54d8d89c84a3975e1beaad8db (patch) | |
tree | 3a8ace0397543a5761b1db7a4b5afbe72a82791c | |
parent | 4629c4b9cb3f20956424b507384fd197a516879b (diff) | |
download | bcm5719-llvm-eb83fabfa03be6e54d8d89c84a3975e1beaad8db.tar.gz bcm5719-llvm-eb83fabfa03be6e54d8d89c84a3975e1beaad8db.zip |
Only check _ZN function prefix in Linux and FreeBSD targets in SymbolFileDWARF
In http://reviews.llvm.org/D9754 I enabled the mangled symbol name lookup
workaround used to find global and anonymous namespace symbols in linux binaries
for all platforms, however we should still only check for these symbols when
processing Linux or FreeBSD binaries where they are relevant. This patch makes
this change.
Test Plan: The tests from the original revision still pass:
TestCallCPPFunction.py
TestCallStopAndContinue.py
TestExprs.py
TestExprsChar.py
TestNamespace.py
TestOverloadedFunctions.py
TestRvalueReferences.py
TestThreadExit.py
Differential Revision: http://reviews.llvm.org/D9782
llvm-svn: 237467
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index ff1fcc39922..121895ccd99 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -26,6 +26,7 @@ #include "llvm/Support/Casting.h" +#include "lldb/Core/ArchSpec.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/ModuleSpec.h" @@ -4036,14 +4037,21 @@ SymbolFileDWARF::FindFunctions (const ConstString &name, // functions debugging FreeBSD and Linux binaries. // If we didn't find any functions in the global namespace try // looking in the basename index but ignore any returned - // functions that have a namespace (ie. mangled names starting with - // '_ZN') but keep functions which have an anonymous namespace + // functions that have a namespace but keep functions which + // have an anonymous namespace + // TODO: The arch in the object file isn't correct for MSVC + // binaries on windows, we should find a way to make it + // correct and handle those symbols as well. if (sc_list.GetSize() == 0) { - SymbolContextList temp_sc_list; - FindFunctions (name, m_function_basename_index, include_inlines, temp_sc_list); - if (!namespace_decl) + ArchSpec arch; + if (!namespace_decl && + GetObjectFile()->GetArchitecture(arch) && + (arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() || + arch.GetMachine() == llvm::Triple::hexagon)) { + SymbolContextList temp_sc_list; + FindFunctions (name, m_function_basename_index, include_inlines, temp_sc_list); SymbolContext sc; for (uint32_t i = 0; i < temp_sc_list.GetSize(); i++) { @@ -4051,6 +4059,8 @@ SymbolFileDWARF::FindFunctions (const ConstString &name, { ConstString mangled_name = sc.GetFunctionName(Mangled::ePreferMangled); ConstString demangled_name = sc.GetFunctionName(Mangled::ePreferDemangled); + // Mangled names on Linux and FreeBSD are of the form: + // _ZN18function_namespace13function_nameEv. if (strncmp(mangled_name.GetCString(), "_ZN", 3) || !strncmp(demangled_name.GetCString(), "(anonymous namespace)", 21)) { |