[Lldb-commits] [lldb] r140881 - in /lldb/trunk: include/lldb/Symbol/Symbol.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/Symbol.cpp

Greg Clayton gclayton at apple.com
Fri Sep 30 13:52:25 PDT 2011


Author: gclayton
Date: Fri Sep 30 15:52:25 2011
New Revision: 140881

URL: http://llvm.org/viewvc/llvm-project?rev=140881&view=rev
Log:
Removed some commented out code from the DWARF parser.

Also reduce the size of the lldb_private::Symbol objects by removing the
lldb_private::Function pointer that was in each symbol. Running Instruments
has shown that when debugging large applications with DWARF in .o files that
lldb_private::Symbol objects are one of the highest users of memory. No one
was using the Symbol::GetFunction() call anyway.


Modified:
    lldb/trunk/include/lldb/Symbol/Symbol.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Symbol/Symbol.cpp

Modified: lldb/trunk/include/lldb/Symbol/Symbol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symbol.h?rev=140881&r1=140880&r2=140881&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Symbol.h (original)
+++ lldb/trunk/include/lldb/Symbol/Symbol.h Fri Sep 30 15:52:25 2011
@@ -114,9 +114,6 @@
     void
     GetDescription (Stream *s, lldb::DescriptionLevel level, Target *target) const;
 
-    Function *
-    GetFunction ();
-
     Address &
     GetValue () { return m_addr_range.GetBaseAddress(); }
 
@@ -203,7 +200,6 @@
                     m_searched_for_function:1;// non-zero if we have looked for the function associated with this symbol already.
     AddressRange    m_addr_range;           // Contains the value, or the section offset address when the value is an address in a section, and the size (if any)
     uint32_t        m_flags;                // A copy of the flags from the original symbol table, the ObjectFile plug-in can interpret these
-    Function *      m_function;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=140881&r1=140880&r2=140881&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Sep 30 15:52:25 2011
@@ -659,39 +659,6 @@
     if (die->Tag() != DW_TAG_subprogram)
         return NULL;
 
-//    clang::DeclContext *containing_decl_ctx = GetClangDeclContextContainingDIE (dwarf_cu, die);
-//    const clang::Decl::Kind containing_decl_kind = containing_decl_ctx->getDeclKind();
-//
-//    switch (containing_decl_kind)
-//    {
-//        case clang::Decl::Record:
-//        case clang::Decl::CXXRecord:
-//        case clang::Decl::ObjCClass:
-//        case clang::Decl::ObjCImplementation:
-//        case clang::Decl::ObjCInterface:
-//            // We have methods of a class or struct
-//            {
-//                const DWARFDebugInfoEntry *containing_decl_die = m_decl_ctx_to_die[containing_decl_ctx];
-//                assert (containing_decl_die);
-//                Type *class_type = ResolveType (dwarf_cu, containing_decl_die);
-//                if (class_type)
-//                    class_type->GetClangFullType();
-//                // Make sure the class definition contains the funciton DIE
-//                // we wanted to parse. If it does, we are done. Else, we need 
-//                // to fall through and parse the function DIE stil...
-//                if (containing_decl_die->Contains (die))
-//                    break; // DIE has been parsed, we are done
-//            }
-//            // Fall through...
-//
-//        default:
-//            // Parse the function prototype as a type that can then be added to concrete function instance
-//            //ParseTypes (sc, dwarf_cu, die, false, false);
-//            break;
-//    }
-    
-    //FixupTypes();
-
     if (die->GetDIENamesAndRanges(this, dwarf_cu, name, mangled, func_ranges, decl_file, decl_line, decl_column, call_file, call_line, call_column, &frame_base))
     {
         // Union of all ranges in the function DIE (if the function is discontiguous)
@@ -720,6 +687,7 @@
                                                decl_line, 
                                                decl_column));
 
+            // Supply the type _only_ if it has already been parsed
             Type *func_type = m_die_to_type.lookup (die);
 
             assert(func_type == NULL || func_type != DIE_IS_BEING_PARSED);
@@ -735,7 +703,8 @@
 
             if (func_sp.get() != NULL)
             {
-                func_sp->GetFrameBaseExpression() = frame_base;
+                if (frame_base.IsValid())
+                    func_sp->GetFrameBaseExpression() = frame_base;
                 sc.comp_unit->AddFunction(func_sp);
                 return func_sp.get();
             }

Modified: lldb/trunk/source/Symbol/Symbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symbol.cpp?rev=140881&r1=140880&r2=140881&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symbol.cpp (original)
+++ lldb/trunk/source/Symbol/Symbol.cpp Fri Sep 30 15:52:25 2011
@@ -33,8 +33,7 @@
     m_size_is_synthesized (false),
     m_searched_for_function (false),
     m_addr_range (),
-    m_flags (),
-    m_function (NULL)
+    m_flags ()
 {
 }
 
@@ -66,8 +65,7 @@
     m_size_is_synthesized (false),
     m_searched_for_function (false),
     m_addr_range (section, offset, size),
-    m_flags (flags),
-    m_function (NULL)
+    m_flags (flags)
 {
 }
 
@@ -97,8 +95,7 @@
     m_size_is_synthesized (false),
     m_searched_for_function (false),
     m_addr_range (range),
-    m_flags (flags),
-    m_function (NULL)
+    m_flags (flags)
 {
 }
 
@@ -116,8 +113,7 @@
     m_size_is_synthesized (false),
     m_searched_for_function (false),
     m_addr_range (rhs.m_addr_range),
-    m_flags (rhs.m_flags),
-    m_function (NULL)
+    m_flags (rhs.m_flags)
 {
 }
 
@@ -140,7 +136,6 @@
         m_searched_for_function = rhs.m_searched_for_function;
         m_addr_range = rhs.m_addr_range;
         m_flags = rhs.m_flags;
-        m_function = rhs.m_function;
     }
     return *this;
 }
@@ -252,23 +247,6 @@
     }
 }
 
-Function *
-Symbol::GetFunction ()
-{
-    if (m_function == NULL && !m_searched_for_function)
-    {
-        m_searched_for_function = true;
-        Module *module = m_addr_range.GetBaseAddress().GetModule();
-        if (module)
-        {
-            SymbolContext sc;
-            if (module->ResolveSymbolContextForAddress(m_addr_range.GetBaseAddress(), eSymbolContextFunction, sc))
-                m_function = sc.function;
-        }
-    }
-    return m_function;
-}
-
 uint32_t
 Symbol::GetPrologueByteSize ()
 {





More information about the lldb-commits mailing list