[PATCH] D124121: Give warning instead of error for premature terminator in .debug_aranges section.

Junfeng Dong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 13:35:22 PDT 2022


junfd created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
junfd requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124121

Files:
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
  llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp


Index: llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
@@ -22,15 +22,15 @@
 
 void DWARFDebugAranges::extract(
     DWARFDataExtractor DebugArangesData,
-    function_ref<void(Error)> RecoverableErrorHandler) {
+    function_ref<void(Error)> RecoverableErrorHandler,
+    function_ref<void(Error)> WarningHandler) {
   if (!DebugArangesData.isValidOffset(0))
     return;
   uint64_t Offset = 0;
   DWARFDebugArangeSet Set;
 
   while (DebugArangesData.isValidOffset(Offset)) {
-    if (Error E =
-            Set.extract(DebugArangesData, &Offset, RecoverableErrorHandler)) {
+    if (Error E = Set.extract(DebugArangesData, &Offset, WarningHandler)) {
       RecoverableErrorHandler(std::move(E));
       return;
     }
@@ -52,7 +52,8 @@
   // Extract aranges from .debug_aranges section.
   DWARFDataExtractor ArangesData(CTX->getDWARFObj().getArangesSection(),
                                  CTX->isLittleEndian(), 0);
-  extract(ArangesData, CTX->getRecoverableErrorHandler());
+  extract(ArangesData, CTX->getRecoverableErrorHandler(),
+          CTX->getWarningHandler());
 
   // Generate aranges from DIEs: even if .debug_aranges section is present,
   // it may describe only a small subset of compilation units, so we need to
Index: llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
===================================================================
--- llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
+++ llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
@@ -28,7 +28,8 @@
 private:
   void clear();
   void extract(DWARFDataExtractor DebugArangesData,
-               function_ref<void(Error)> RecoverableErrorHandler);
+               function_ref<void(Error)> RecoverableErrorHandler,
+               function_ref<void(Error)> WarningHandler);
 
   /// Call appendRange multiple times and then call construct.
   void appendRange(uint64_t CUOffset, uint64_t LowPC, uint64_t HighPC);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124121.424012.patch
Type: text/x-patch
Size: 2085 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220420/a636a181/attachment.bin>


More information about the llvm-commits mailing list