diff options
-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) { |