[Lldb-commits] [lldb] r190365 - Fixed parsing of the .debug_aranges section so that LLDB will still work correctly even if arange data is not available for every object file in the program.

Richard Mitton richard at codersnotes.com
Mon Sep 9 16:17:41 PDT 2013


Author: rmitton
Date: Mon Sep  9 18:17:40 2013
New Revision: 190365

URL: http://llvm.org/viewvc/llvm-project?rev=190365&view=rev
Log:
Fixed parsing of the .debug_aranges section so that LLDB will still work correctly even if arange data is not available for every object file in the program.

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=190365&r1=190364&r2=190365&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Mon Sep  9 18:17:40 2013
@@ -66,18 +66,35 @@ DWARFDebugInfo::GetCompileUnitAranges ()
             m_cu_aranges_ap->Extract (debug_aranges_data);
             
         }
-        else
+
+        // Make a list of all CUs represented by the arange data in the file.
+        std::set<dw_offset_t> cus_with_data;
+        for (size_t n=0;n<m_cu_aranges_ap.get()->GetNumRanges();n++)
         {
-            if (log)
-                log->Printf ("DWARFDebugInfo::GetCompileUnitAranges() for \"%s\" by parsing", 
-                             m_dwarf2Data->GetObjectFile()->GetFileSpec().GetPath().c_str());
-            const size_t num_compile_units = GetNumCompileUnits();
-            const bool clear_dies_if_already_not_parsed = true;
-            for (size_t idx = 0; idx < num_compile_units; ++idx)
+            dw_offset_t offset = m_cu_aranges_ap.get()->OffsetAtIndex(n);
+            if (offset != DW_INVALID_OFFSET)
+                cus_with_data.insert (offset);
+        }
+
+        // Manually build arange data for everything that wasn't in the .debug_aranges table.
+        bool printed = false;
+        const size_t num_compile_units = GetNumCompileUnits();
+        const bool clear_dies_if_already_not_parsed = true;
+        for (size_t idx = 0; idx < num_compile_units; ++idx)
+        {
+            DWARFCompileUnit* cu = GetCompileUnitAtIndex(idx);
+
+            dw_offset_t offset = cu->GetOffset();
+            if (cus_with_data.find(offset) == cus_with_data.end())
             {
-                DWARFCompileUnit* cu = GetCompileUnitAtIndex(idx);
-                if (cu)
-                    cu->BuildAddressRangeTable (m_dwarf2Data, m_cu_aranges_ap.get(), clear_dies_if_already_not_parsed);
+                if (log)
+                {
+                    if (!printed)
+                        log->Printf ("DWARFDebugInfo::GetCompileUnitAranges() for \"%s\" by parsing",
+                                     m_dwarf2Data->GetObjectFile()->GetFileSpec().GetPath().c_str());
+                    printed = true;
+                }
+                cu->BuildAddressRangeTable (m_dwarf2Data, m_cu_aranges_ap.get(), clear_dies_if_already_not_parsed);
             }
         }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp?rev=190365&r1=190364&r2=190365&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp Mon Sep  9 18:17:40 2013
@@ -174,10 +174,11 @@ LogChannelDWARF::ListCategories (Stream
 {
     strm->Printf ("Logging categories for '%s':\n"
                   "  all - turn on all available logging categories\n"
-                  "  info - log the parsing if .debug_info\n"
-                  "  line - log the parsing if .debug_line\n"
-                  "  pubnames - log the parsing if .debug_pubnames\n"
-                  "  pubtypes - log the parsing if .debug_pubtypes\n"
+                  "  info - log the parsing of .debug_info\n"
+                  "  line - log the parsing of .debug_line\n"
+                  "  pubnames - log the parsing of .debug_pubnames\n"
+                  "  pubtypes - log the parsing of .debug_pubtypes\n"
+                  "  aranges - log the parsing of .debug_aranges\n"
                   "  lookups - log any lookups that happen by name, regex, or address\n"
                   "  completion - log struct/unions/class type completions\n"
                   "  map - log insertions of object files into DWARF debug maps\n",





More information about the lldb-commits mailing list