[Lldb-commits] [lldb] r142933 - /lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp

Sean Callanan scallanan at apple.com
Tue Oct 25 11:02:05 PDT 2011


Author: spyffe
Date: Tue Oct 25 13:02:05 2011
New Revision: 142933

URL: http://llvm.org/viewvc/llvm-project?rev=142933&view=rev
Log:
Fixed our handling of const functions, compensating
for debug information that occasionally gets the
const-ness of member functions wrong.  We used to
demangle the name, add "const," and remangle it; now
we handle the mangled name directly, which is more
robust.

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=142933&r1=142932&r2=142933&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Tue Oct 25 13:02:05 2011
@@ -674,22 +674,17 @@
         // 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()))
+        if (!strncmp(name.GetCString(), "_ZN", 3) &&
+            strncmp(name.GetCString(), "_ZNK", 4))
         {
-            std::string const_name_scratch(demangled_name.GetCString());
-            
-            const_name_scratch.append(" const");
-            
-            ConstString const_name(const_name_scratch.c_str());
-                        
-            FindCodeSymbolInContext(name, m_parser_vars->m_sym_ctx, sc_list);
+            std::string fixed_scratch("_ZNK");
+            fixed_scratch.append(name.GetCString() + 3);
+            ConstString fixed_name(fixed_scratch.c_str());
             
             if (log)
-                log->Printf("Found %d results with const name %s", sc_list.GetSize(), const_name.GetCString());
+                log->Printf("Failed to find symbols given non-const name %s; trying %s", name.GetCString(), fixed_name.GetCString());
+            
+            FindCodeSymbolInContext(fixed_name, m_parser_vars->m_sym_ctx, sc_list);
         }
     }
     





More information about the lldb-commits mailing list