[llvm] 05b1a2c - Revert "[ORC] Add N_SO and N_OSO stabs entries to MachO debug objects."

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 11:04:15 PDT 2023


Author: Lang Hames
Date: 2023-09-22T11:03:35-07:00
New Revision: 05b1a2cb3e6f0c7e783fcbd9e562d605c307ca6a

URL: https://github.com/llvm/llvm-project/commit/05b1a2cb3e6f0c7e783fcbd9e562d605c307ca6a
DIFF: https://github.com/llvm/llvm-project/commit/05b1a2cb3e6f0c7e783fcbd9e562d605c307ca6a.diff

LOG: Revert "[ORC] Add N_SO and N_OSO stabs entries to MachO debug objects."

This reverts commit db51e572893e9e4403d65920dc5e87a8885b059c.

Reverted while I investigate build failures, e.g.
https://lab.llvm.org/buildbot/#/builders/234/builds/12900

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp b/llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp
index 0c973c3a764359e..63c188676d197b4 100644
--- a/llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp
@@ -16,10 +16,6 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/BinaryFormat/MachO.h"
-#include "llvm/DebugInfo/DWARF/DWARFContext.h"
-#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
-
-#include <chrono>
 
 #define DEBUG_TYPE "orc"
 
@@ -101,6 +97,8 @@ class MachODebugObjectSynthesizer : public MachODebugObjectSynthesizerBase {
              << "\n";
     });
 
+    auto &SDOSec = G.createSection(SynthDebugSectionName, MemProt::Read);
+
     for (auto &Sec : G.sections()) {
       if (Sec.blocks().empty())
         continue;
@@ -116,10 +114,6 @@ class MachODebugObjectSynthesizer : public MachODebugObjectSynthesizerBase {
         NonDebugSections.push_back({&Sec, nullptr});
     }
 
-    // Bail out early if no debug sections.
-    if (DebugSections.empty())
-      return Error::success();
-
     // Write MachO header and debug section load commands.
     Builder.Header.filetype = MachO::MH_OBJECT;
     switch (G.getTargetTriple().getArch()) {
@@ -137,51 +131,15 @@ class MachODebugObjectSynthesizer : public MachODebugObjectSynthesizerBase {
 
     Seg = &Builder.addSegment("");
 
-    StringMap<std::unique_ptr<MemoryBuffer>> DebugSectionMap;
-    StringRef DebugLineSectionData;
     for (auto &DSec : DebugSections) {
       auto [SegName, SecName] = DSec.GraphSec->getName().split(',');
       DSec.BuilderSec = &Seg->addSection(SecName, SegName);
 
       SectionRange SR(*DSec.GraphSec);
       DSec.BuilderSec->Content.Size = SR.getSize();
-      if (!SR.empty()) {
+      if (!SR.empty())
         DSec.BuilderSec->align = Log2_64(SR.getFirstBlock()->getAlignment());
-        StringRef SectionData(SR.getFirstBlock()->getContent().data(),
-                              SR.getFirstBlock()->getSize());
-        DebugSectionMap[SecName] =
-            MemoryBuffer::getMemBuffer(SectionData, G.getName(), false);
-        if (SecName == "__debug_line")
-          DebugLineSectionData = SectionData;
-      }
-    }
-
-    if (DebugLineSectionData.empty())
-      return make_error<StringError>(G.getName() +
-                                         " has debug info but no line table",
-                                     inconvertibleErrorCode());
-
-    // Add Stabs.
-    auto DWARFCtx = DWARFContext::create(DebugSectionMap, G.getPointerSize(),
-                                         G.getEndianness());
-    DWARFDataExtractor DebugLineData(
-        DebugLineSectionData, G.getEndianness() == support::endianness::little,
-        G.getPointerSize());
-    uint64_t Offset = 0;
-    DWARFDebugLine::LineTable LineTable;
-    if (auto Err = LineTable.parse(DebugLineData, &Offset, *DWARFCtx, nullptr,
-                                   consumeError))
-      return Err;
-
-    Builder.addSymbol("", MachO::N_SO, 0, 0, 0);
-    for (auto &FN : LineTable.Prologue.FileNames) {
-      if (auto Name = dwarf::toString(FN.Name))
-        Builder.addSymbol(*Name, MachO::N_SO, 0, 0, 0);
     }
-    auto TimeStamp = std::chrono::duration_cast<std::chrono::seconds>(
-                         std::chrono::system_clock::now().time_since_epoch())
-                         .count();
-    Builder.addSymbol("", MachO::N_OSO, 3, 1, TimeStamp);
 
     for (auto &NDSP : NonDebugSections) {
       auto [SegName, SecName] = NDSP.GraphSec->getName().split(',');
@@ -206,12 +164,8 @@ class MachODebugObjectSynthesizer : public MachODebugObjectSynthesizerBase {
       }
     }
 
-    Builder.addSymbol("", MachO::N_SO, 1, 0, 0);
-
-    // Lay out the debug object, create a section and block for it.
     size_t DebugObjectSize = Builder.layout();
 
-    auto &SDOSec = G.createSection(SynthDebugSectionName, MemProt::Read);
     MachOContainerBlock = &G.createMutableContentBlock(
         SDOSec, G.allocateBuffer(DebugObjectSize), orc::ExecutorAddr(), 8, 0);
 


        


More information about the llvm-commits mailing list