[PATCH] D143073: [DebugInfo] Handle fixed-width DW_FORM_addrx variants in DWARFFormValue::getAsSectionedAddress()

Benjamin Maxwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 07:39:16 PST 2023


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

Previously this would incorrectly return the raw offset into the .debug_addr section for the
DW_FORM_addrx1/2/3/4 forms rather than the actual address.

Note that this was handled correctly in the dump() function so this issue only occurs for users
of this API and not in tools such as llvm-dwarfdump.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143073

Files:
  llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp


Index: llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
@@ -677,7 +677,9 @@
   if (!isFormClass(FC_Address))
     return std::nullopt;
   bool AddrOffset = Form == dwarf::DW_FORM_LLVM_addrx_offset;
-  if (Form == DW_FORM_GNU_addr_index || Form == DW_FORM_addrx || AddrOffset) {
+  if (Form == DW_FORM_GNU_addr_index || Form == DW_FORM_addrx ||
+      Form == DW_FORM_addrx1 || Form == DW_FORM_addrx2 ||
+      Form == DW_FORM_addrx3 || Form == DW_FORM_addrx4 || AddrOffset) {
 
     uint32_t Index = AddrOffset ? (Value.uval >> 32) : Value.uval;
     if (!U)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143073.493943.patch
Type: text/x-patch
Size: 718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230201/43620770/attachment.bin>


More information about the llvm-commits mailing list