[llvm] Allow the dumping of .dwo files contents to show up when dumping an e… (PR #66726)

Greg Clayton via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 14:31:22 PST 2023


================
@@ -390,15 +398,25 @@ static void filterByName(
     const StringSet<> &Names, DWARFContext::unit_iterator_range CUs,
     raw_ostream &OS,
     std::function<StringRef(uint64_t RegNum, bool IsEH)> GetNameForDWARFReg) {
-  for (const auto &CU : CUs)
-    for (const auto &Entry : CU->dies()) {
-      DWARFDie Die = {CU.get(), &Entry};
+  auto filterDieNames = [&](DWARFUnit *Unit) {
+    for (const auto &Entry : Unit->dies()) {
+      DWARFDie Die = {Unit, &Entry};
       if (const char *Name = Die.getName(DINameKind::ShortName))
         if (filterByName(Names, Die, Name, OS, GetNameForDWARFReg))
           continue;
       if (const char *Name = Die.getName(DINameKind::LinkageName))
         filterByName(Names, Die, Name, OS, GetNameForDWARFReg);
     }
+  };
+  for (const auto &CU : CUs) {
+    filterDieNames(CU.get());
+    // If we have split DWARF, then recurse down into the .dwo files as well.
+    DWARFDie CUDie = CU->getUnitDIE(false);
+    DWARFDie CUNonSkeletonDie = CU->getNonSkeletonUnitDIE(false);
+    // If we have a DWO file, we need to search it as well
+    if (CUNonSkeletonDie && CUDie != CUNonSkeletonDie)
----------------
clayborg wrote:

done

https://github.com/llvm/llvm-project/pull/66726


More information about the llvm-commits mailing list