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

Sean Callanan scallanan at apple.com
Tue Aug 16 11:09:29 PDT 2011


Author: spyffe
Date: Tue Aug 16 13:09:29 2011
New Revision: 137731

URL: http://llvm.org/viewvc/llvm-project?rev=137731&view=rev
Log:
Fixed a performance problem where functions were
being searched for in too heavyweight a way.  Now,
when asking for the address of a function, the
expression parser just asks for a corresponding
data symbol.

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=137731&r1=137730&r2=137731&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Tue Aug 16 13:09:29 2011
@@ -497,6 +497,21 @@
     return true;
 }
 
+static void
+FindCodeSymbolInContext
+(
+    const ConstString &name,
+    SymbolContext &sym_ctx,
+    SymbolContextList &sc_list
+)
+{
+    if (sym_ctx.module_sp)
+       sym_ctx.module_sp->FindSymbolsWithNameAndType(name, eSymbolTypeCode, sc_list);
+    
+    if (!sc_list.GetSize())
+        sym_ctx.target_sp->GetImages().FindSymbolsWithNameAndType(name, eSymbolTypeCode, sc_list);
+}
+
 bool
 ClangExpressionDeclMap::GetFunctionAddress 
 (
@@ -515,10 +530,9 @@
         return false;
 
     SymbolContextList sc_list;
-    const bool include_symbols = true;
-    const bool append = false;
-    m_parser_vars->m_sym_ctx.FindFunctionsByName(name, include_symbols, append, sc_list);
     
+    FindCodeSymbolInContext(name, m_parser_vars->m_sym_ctx, sc_list);
+        
     if (!sc_list.GetSize())
     {
         // We occasionally get debug information in which a const function is reported 
@@ -536,7 +550,7 @@
             
             ConstString const_name(const_name_scratch.c_str());
                         
-            m_parser_vars->m_sym_ctx.FindFunctionsByName(const_name, include_symbols, append, sc_list);
+            FindCodeSymbolInContext(name, m_parser_vars->m_sym_ctx, sc_list);
             
             if (log)
                 log->Printf("Found %d results with const name %s", sc_list.GetSize(), const_name.GetCString());





More information about the lldb-commits mailing list