Skip to content

Commit 05b1a2c

Browse files
committed
Revert "[ORC] Add N_SO and N_OSO stabs entries to MachO debug objects."
This reverts commit db51e57. Reverted while I investigate build failures, e.g. https://lab.llvm.org/buildbot/#/builders/234/builds/12900
1 parent db51e57 commit 05b1a2c

File tree

1 file changed

+3
-49
lines changed

1 file changed

+3
-49
lines changed

llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
#include "llvm/ADT/SmallVector.h"
1717
#include "llvm/ADT/StringSet.h"
1818
#include "llvm/BinaryFormat/MachO.h"
19-
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
20-
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
21-
22-
#include <chrono>
2319

2420
#define DEBUG_TYPE "orc"
2521

@@ -101,6 +97,8 @@ class MachODebugObjectSynthesizer : public MachODebugObjectSynthesizerBase {
10197
<< "\n";
10298
});
10399

100+
auto &SDOSec = G.createSection(SynthDebugSectionName, MemProt::Read);
101+
104102
for (auto &Sec : G.sections()) {
105103
if (Sec.blocks().empty())
106104
continue;
@@ -116,10 +114,6 @@ class MachODebugObjectSynthesizer : public MachODebugObjectSynthesizerBase {
116114
NonDebugSections.push_back({&Sec, nullptr});
117115
}
118116

119-
// Bail out early if no debug sections.
120-
if (DebugSections.empty())
121-
return Error::success();
122-
123117
// Write MachO header and debug section load commands.
124118
Builder.Header.filetype = MachO::MH_OBJECT;
125119
switch (G.getTargetTriple().getArch()) {
@@ -137,51 +131,15 @@ class MachODebugObjectSynthesizer : public MachODebugObjectSynthesizerBase {
137131

138132
Seg = &Builder.addSegment("");
139133

140-
StringMap<std::unique_ptr<MemoryBuffer>> DebugSectionMap;
141-
StringRef DebugLineSectionData;
142134
for (auto &DSec : DebugSections) {
143135
auto [SegName, SecName] = DSec.GraphSec->getName().split(',');
144136
DSec.BuilderSec = &Seg->addSection(SecName, SegName);
145137

146138
SectionRange SR(*DSec.GraphSec);
147139
DSec.BuilderSec->Content.Size = SR.getSize();
148-
if (!SR.empty()) {
140+
if (!SR.empty())
149141
DSec.BuilderSec->align = Log2_64(SR.getFirstBlock()->getAlignment());
150-
StringRef SectionData(SR.getFirstBlock()->getContent().data(),
151-
SR.getFirstBlock()->getSize());
152-
DebugSectionMap[SecName] =
153-
MemoryBuffer::getMemBuffer(SectionData, G.getName(), false);
154-
if (SecName == "__debug_line")
155-
DebugLineSectionData = SectionData;
156-
}
157-
}
158-
159-
if (DebugLineSectionData.empty())
160-
return make_error<StringError>(G.getName() +
161-
" has debug info but no line table",
162-
inconvertibleErrorCode());
163-
164-
// Add Stabs.
165-
auto DWARFCtx = DWARFContext::create(DebugSectionMap, G.getPointerSize(),
166-
G.getEndianness());
167-
DWARFDataExtractor DebugLineData(
168-
DebugLineSectionData, G.getEndianness() == support::endianness::little,
169-
G.getPointerSize());
170-
uint64_t Offset = 0;
171-
DWARFDebugLine::LineTable LineTable;
172-
if (auto Err = LineTable.parse(DebugLineData, &Offset, *DWARFCtx, nullptr,
173-
consumeError))
174-
return Err;
175-
176-
Builder.addSymbol("", MachO::N_SO, 0, 0, 0);
177-
for (auto &FN : LineTable.Prologue.FileNames) {
178-
if (auto Name = dwarf::toString(FN.Name))
179-
Builder.addSymbol(*Name, MachO::N_SO, 0, 0, 0);
180142
}
181-
auto TimeStamp = std::chrono::duration_cast<std::chrono::seconds>(
182-
std::chrono::system_clock::now().time_since_epoch())
183-
.count();
184-
Builder.addSymbol("", MachO::N_OSO, 3, 1, TimeStamp);
185143

186144
for (auto &NDSP : NonDebugSections) {
187145
auto [SegName, SecName] = NDSP.GraphSec->getName().split(',');
@@ -206,12 +164,8 @@ class MachODebugObjectSynthesizer : public MachODebugObjectSynthesizerBase {
206164
}
207165
}
208166

209-
Builder.addSymbol("", MachO::N_SO, 1, 0, 0);
210-
211-
// Lay out the debug object, create a section and block for it.
212167
size_t DebugObjectSize = Builder.layout();
213168

214-
auto &SDOSec = G.createSection(SynthDebugSectionName, MemProt::Read);
215169
MachOContainerBlock = &G.createMutableContentBlock(
216170
SDOSec, G.allocateBuffer(DebugObjectSize), orc::ExecutorAddr(), 8, 0);
217171

0 commit comments

Comments
 (0)