[PATCH] D136652: [DebugInfo] Ignore aranges starting with 0

Dangyi Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 24 17:35:24 PDT 2022


dangyi created this revision.
dangyi added a reviewer: phosek.
dangyi added a project: debug-info.
Herald added a subscriber: hiraditya.
Herald added a project: All.
dangyi requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When `--gc-sections` is enabled, unused compile units will be removed
from the output but their debug info will be kept, with their starting
addresses set to 0 to indicate they are garbages. This causes symbolizer
and addr2line to fail when a large garbage DWARF unit overlaps with the
actual code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136652

Files:
  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
@@ -81,7 +81,7 @@
 
 void DWARFDebugAranges::appendRange(uint64_t CUOffset, uint64_t LowPC,
                                     uint64_t HighPC) {
-  if (LowPC >= HighPC)
+  if (LowPC >= HighPC || LowPC == 0)
     return;
   Endpoints.emplace_back(LowPC, CUOffset, true);
   Endpoints.emplace_back(HighPC, CUOffset, false);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136652.470335.patch
Type: text/x-patch
Size: 549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221025/1fef4fea/attachment.bin>


More information about the llvm-commits mailing list