[Lldb-commits] [lldb] r159975 - /lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

Greg Clayton gclayton at apple.com
Mon Jul 9 18:22:16 PDT 2012


Author: gclayton
Date: Mon Jul  9 20:22:15 2012
New Revision: 159975

URL: http://llvm.org/viewvc/llvm-project?rev=159975&view=rev
Log:
Improve dynamic type resolution efficiency by looking for the type in the module that contains the vtable symbol first and only look for the first match. If we don't find anything, _then_ move on to the rest of the modules in the target and watch out for multiple matches.


Modified:
    lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=159975&r1=159974&r2=159975&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Mon Jul  9 20:22:15 2012
@@ -119,11 +119,29 @@
                         const bool exact_match = true;
                         TypeList class_types;
                         
-                        uint32_t num_matches = target->GetImages().FindTypes (sc,
-                                                                              ConstString(class_name),
-                                                                              exact_match,
-                                                                              UINT32_MAX,
-                                                                              class_types);
+                        uint32_t num_matches = 0;
+                        // First look in the module that the vtable symbol came from
+                        // and look for a single exact match.
+                        if (sc.module_sp)
+                        {
+                            num_matches = sc.module_sp->FindTypes (sc,
+                                                                   ConstString(class_name),
+                                                                   exact_match,
+                                                                   1,
+                                                                   class_types);
+                        }
+                        
+                        // If we didn't find a symbol, then move on to the entire
+                        // module list in the target and get as many unique matches
+                        // as possible
+                        if (num_matches == 0)
+                        {
+                            num_matches = target->GetImages().FindTypes (sc,
+                                                                         ConstString(class_name),
+                                                                         exact_match,
+                                                                         UINT32_MAX,
+                                                                         class_types);
+                        }
                         
                         lldb::TypeSP type_sp;
                         if (num_matches == 0)





More information about the lldb-commits mailing list