diff options
author | Sean Callanan <scallanan@apple.com> | 2014-11-11 02:49:44 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2014-11-11 02:49:44 +0000 |
commit | a0d5643610b8c9fd9f553e249181ed771e3cc2b2 (patch) | |
tree | dc11e734e1b63c661817d7ebf905c83dfb3618e0 /lldb/source/Expression/ClangExpressionDeclMap.cpp | |
parent | 4cb85f36ca0e3b38b08608efcb3ee29321fb390a (diff) | |
download | bcm5719-llvm-a0d5643610b8c9fd9f553e249181ed771e3cc2b2.tar.gz bcm5719-llvm-a0d5643610b8c9fd9f553e249181ed771e3cc2b2.zip |
Made the expression parser more resilient against
being asked about symbols it doesn't know about. If
it's asked about a symbol by mangled name and it finds
nothing, then it will try again with the demangled
base name.
llvm-svn: 221660
Diffstat (limited to 'lldb/source/Expression/ClangExpressionDeclMap.cpp')
-rw-r--r-- | lldb/source/Expression/ClangExpressionDeclMap.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index 13f19a16cf5..5b7065d388a 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -36,6 +36,7 @@ #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/Variable.h" #include "lldb/Symbol/VariableList.h" +#include "lldb/Target/CPPLanguageRuntime.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" @@ -543,6 +544,7 @@ ClangExpressionDeclMap::GetFunctionAddress FindCodeSymbolInContext(name, m_parser_vars->m_sym_ctx, sc_list); uint32_t sc_list_size = sc_list.GetSize(); + if (sc_list_size == 0) { // We occasionally get debug information in which a const function is reported @@ -562,6 +564,25 @@ ClangExpressionDeclMap::GetFunctionAddress sc_list_size = sc_list.GetSize(); } } + + if (sc_list_size == 0) + { + // Sometimes we get a mangled name for a global function that actually should be "extern C." + // This is a hack to compensate. + + const bool is_mangled = true; + Mangled mangled(name, is_mangled); + + CPPLanguageRuntime::MethodName method_name(mangled.GetDemangledName()); + + llvm::StringRef basename = method_name.GetBasename(); + + if (!basename.empty()) + { + FindCodeSymbolInContext(ConstString(basename), m_parser_vars->m_sym_ctx, sc_list); + sc_list_size = sc_list.GetSize(); + } + } for (uint32_t i=0; i<sc_list_size; ++i) { |