[llvm] 6a07f1e - debug_rnglists/symbolizing: reduce memory usage by not caching rnglists

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 19:36:18 PDT 2020


Author: David Blaikie
Date: 2020-09-16T19:36:07-07:00
New Revision: 6a07f1edf8e6a172734286cd3ab5988313313d8f

URL: https://github.com/llvm/llvm-project/commit/6a07f1edf8e6a172734286cd3ab5988313313d8f
DIFF: https://github.com/llvm/llvm-project/commit/6a07f1edf8e6a172734286cd3ab5988313313d8f.diff

LOG: debug_rnglists/symbolizing: reduce memory usage by not caching rnglists

This matches the debug_ranges behavior - though is currently implemented
differently. (the debug_ranges parsing was handled by creating a new
ranges parser during DIE address querying, and just destroying it after
the query - whereas the rnglists parser is a member of the DWARFUnit
currently - so the API doesn't cache anymore)

I think this could/should be improved by not parsing debug_rnglists
headers at all when dumping debug_info or symbolizing - do it the way
DWARF (roughly) intended: take the rnglists_base, add addr*index to it,
read the offset, parse the list at rnglists_base+offset. This would have
no error checking for valid index (because the number of valid indexes
is stored in the header, which has a negative offset from rnglists_base
- and is sort of only intended for use by dumpers, not by parsers going
from debug_info to a rnglist) or out of contribution bounds access
(since it wouldn't know the length of the contribution, also in the
header) - nor any error-checking that the rnglist contribution was using
the same properties as the debug_info (version, DWARF32/64, address
size, etc).

Added: 
    

Modified: 
    llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
index bcfc71381aee..e54bed2d65d6 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
@@ -270,19 +270,13 @@ template <typename DWARFListType>
 Expected<DWARFListType>
 DWARFListTableBase<DWARFListType>::findList(DWARFDataExtractor Data,
                                             uint64_t Offset) {
-  auto Entry = ListMap.find(Offset);
-  if (Entry != ListMap.end())
-    return Entry->second;
-
   // Extract the list from the section and enter it into the list map.
   DWARFListType List;
   uint64_t End = getHeaderOffset() + Header.length();
-  uint64_t StartingOffset = Offset;
   if (Error E =
           List.extract(Data, getHeaderOffset(), End, &Offset,
                        Header.getSectionName(), Header.getListTypeString()))
     return std::move(E);
-  ListMap[StartingOffset] = List;
   return List;
 }
 


        


More information about the llvm-commits mailing list