[Lldb-commits] [lldb] r221660 - Made the expression parser more resilient against

Sean Callanan scallanan at apple.com
Mon Nov 10 18:49:44 PST 2014


Author: spyffe
Date: Mon Nov 10 20:49:44 2014
New Revision: 221660

URL: http://llvm.org/viewvc/llvm-project?rev=221660&view=rev
Log:
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.

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=221660&r1=221659&r2=221660&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Mon Nov 10 20:49:44 2014
@@ -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::GetFunctionAddre
     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::GetFunctionAddre
             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)
     {





More information about the lldb-commits mailing list