[BOLT][DWARF][NFC] Set initial offset of DIE
authorAlexander Yermolovich <ayermolo@meta.com>
Thu, 13 Jul 2023 17:44:29 +0000 (10:44 -0700)
committerAlexander Yermolovich <ayermolo@meta.com>
Thu, 13 Jul 2023 17:44:44 +0000 (10:44 -0700)
Setting initial offset of DIE to input DIE. This is to make "printf" debugging
easier.

Reviewed By: maksfb

Differential Revision: https://reviews.llvm.org/D155031

bolt/lib/Core/DIEBuilder.cpp

index 4421daf8e65ff564992bc724da79b2d747b3d7df..2344a69c00fde319c5fa95d063062cad434f5aa3 100644 (file)
@@ -290,6 +290,10 @@ DIE *DIEBuilder::constructDIEFast(DWARFDie &DDie, DWARFUnit &U,
   DIEInfo &DieInfo = getDIEInfo(UnitId, *Idx);
 
   uint64_t Offset = DDie.getOffset();
+  // Just for making debugging easier.
+  // DIE dump is not very useful.
+  // It's nice to know original offset from which this DIE was constructed.
+  DieInfo.Die->setOffset(Offset);
   uint64_t NextOffset = Offset;
   DWARFDataExtractor Data = U.getDebugInfoExtractor();
   DWARFDebugInfoEntry DDIEntry;