[PATCH] D154655: [DebugInfo] Force users of DWARFDebugAbbrev to call parse before iterating

Alex Langford via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 11:35:06 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb7acb3d4a5d7: [DebugInfo] Force users of DWARFDebugAbbrev to call parse before iterating (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154655/new/

https://reviews.llvm.org/D154655

Files:
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
  llvm/tools/obj2yaml/dwarf2yaml.cpp


Index: llvm/tools/obj2yaml/dwarf2yaml.cpp
===================================================================
--- llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -26,6 +26,7 @@
   auto AbbrevSetPtr = DCtx.getDebugAbbrev();
   if (AbbrevSetPtr) {
     uint64_t AbbrevTableID = 0;
+    AbbrevSetPtr->parse();
     for (auto AbbrvDeclSet : *AbbrevSetPtr) {
       Y.DebugAbbrev.emplace_back();
       Y.DebugAbbrev.back().ID = AbbrevTableID++;
@@ -219,6 +220,7 @@
     if (NewUnit.Version >= 5)
       NewUnit.Type = (dwarf::UnitType)CU->getUnitType();
     const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev();
+    DebugAbbrev->parse();
     NewUnit.AbbrevTableID = std::distance(
         DebugAbbrev->begin(),
         llvm::find_if(
Index: llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
===================================================================
--- llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
+++ llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
@@ -73,7 +73,7 @@
   void parse() const;
 
   DWARFAbbreviationDeclarationSetMap::const_iterator begin() const {
-    parse();
+    assert(!Data && "Must call parse before iterating over DWARFDebugAbbrev");
     return AbbrDeclSets.begin();
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154655.540134.patch
Type: text/x-patch
Size: 1261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230713/f98f7843/attachment.bin>


More information about the llvm-commits mailing list