[PATCH] D157354: [BOLT][DWARF][NFC] Add function to print DIE
Alexander Yermolovich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 8 16:03:37 PDT 2023
ayermolo updated this revision to Diff 548389.
ayermolo added a comment.
addressed comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157354/new/
https://reviews.llvm.org/D157354
Files:
bolt/lib/Rewrite/DWARFRewriter.cpp
Index: bolt/lib/Rewrite/DWARFRewriter.cpp
===================================================================
--- bolt/lib/Rewrite/DWARFRewriter.cpp
+++ bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -57,7 +57,6 @@
#undef DEBUG_TYPE
#define DEBUG_TYPE "bolt"
-LLVM_ATTRIBUTE_UNUSED
static void printDie(const DWARFDie &DIE) {
DIDumpOptions DumpOpts;
DumpOpts.ShowForm = true;
@@ -67,6 +66,28 @@
DIE.dump(dbgs(), 0, DumpOpts);
}
+/// Lazily parse DWARF DIE and print it out.
+LLVM_ATTRIBUTE_UNUSED
+static void printDie(DWARFUnit &DU, uint64_t DIEOffset) {
+ uint64_t OriginalOffsets = DIEOffset;
+ uint64_t NextCUOffset = DU.getNextUnitOffset();
+ DWARFDataExtractor DebugInfoData = DU.getDebugInfoExtractor();
+ DWARFDebugInfoEntry DIEEntry;
+ if (DIEEntry.extractFast(DU, &DIEOffset, DebugInfoData, NextCUOffset, 0)) {
+ if (const DWARFAbbreviationDeclaration *AbbrDecl =
+ DIEEntry.getAbbreviationDeclarationPtr()) {
+ DWARFDie DDie(&DU, &DIEEntry);
+ printDie(DDie);
+ } else {
+ dbgs() << "Failed to extract abbreviation for"
+ << Twine::utohexstr(OriginalOffsets) << "\n";
+ }
+ } else {
+ dbgs() << "Failed to extract DIE for " << Twine::utohexstr(OriginalOffsets)
+ << " \n";
+ }
+}
+
namespace llvm {
namespace bolt {
/// Emits debug information into .debug_info or .debug_types section.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157354.548389.patch
Type: text/x-patch
Size: 1375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230808/1f597342/attachment.bin>
More information about the llvm-commits
mailing list