summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2011-05-13 18:27:02 +0000
committerSean Callanan <scallanan@apple.com>2011-05-13 18:27:02 +0000
commit19b6afe35e252b923ad8edf6ce2b57ae84de6021 (patch)
treefc27787be25c2963e1256437a0f7e23ae41b0135
parenta52b1f72ef9146bfa290b1709aee78dbf86d13ae (diff)
downloadbcm5719-llvm-19b6afe35e252b923ad8edf6ce2b57ae84de6021.tar.gz
bcm5719-llvm-19b6afe35e252b923ad8edf6ce2b57ae84de6021.zip
For cases where a const function is inaccurately reported
as non-const in the debug information, added a fallback to GetFunctionAddress, adding the const qualifier after the fact and searching again. llvm-svn: 131299
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index b2fe2da3e66..3f80c1d72ba 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -500,6 +500,8 @@ ClangExpressionDeclMap::GetFunctionAddress
{
assert (m_parser_vars.get());
+ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
// Back out in all cases where we're not fully initialized
if (m_parser_vars->m_exe_ctx->target == NULL)
return false;
@@ -512,6 +514,30 @@ ClangExpressionDeclMap::GetFunctionAddress
m_parser_vars->m_sym_ctx.FindFunctionsByName(name, include_symbols, append, sc_list);
if (!sc_list.GetSize())
+ {
+ // We occasionally get debug information in which a const function is reported
+ // as non-const, so the mangled name is wrong. This is a hack to compensate.
+
+ Mangled mangled(name.GetCString(), true);
+
+ ConstString demangled_name = mangled.GetDemangledName();
+
+ if (strlen(demangled_name.GetCString()))
+ {
+ std::string const_name_scratch(demangled_name.GetCString());
+
+ const_name_scratch.append(" const");
+
+ ConstString const_name(const_name_scratch.c_str());
+
+ m_parser_vars->m_sym_ctx.FindFunctionsByName(const_name, include_symbols, append, sc_list);
+
+ if (log)
+ log->Printf("Found %d results with const name %s", sc_list.GetSize(), const_name.GetCString());
+ }
+ }
+
+ if (!sc_list.GetSize())
return false;
SymbolContext sym_ctx;
OpenPOWER on IntegriCloud