[Lldb-commits] [lldb] r131299 - /lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Sean Callanan
scallanan at apple.com
Fri May 13 11:27:02 PDT 2011
Author: spyffe
Date: Fri May 13 13:27:02 2011
New Revision: 131299
URL: http://llvm.org/viewvc/llvm-project?rev=131299&view=rev
Log:
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.
Modified:
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=131299&r1=131298&r2=131299&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri May 13 13:27:02 2011
@@ -500,6 +500,8 @@
{
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 @@
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;
More information about the lldb-commits
mailing list