@@ -138,8 +138,7 @@ DebugRangesSectionWriter::DebugRangesSectionWriter() {
138
138
RangesStream = std::make_unique<raw_svector_ostream>(*RangesBuffer);
139
139
140
140
// Add an empty range as the first entry;
141
- SectionOffset +=
142
- writeAddressRanges (*RangesStream.get (), DebugAddressRangesVector{});
141
+ writeAddressRanges (*RangesStream.get (), DebugAddressRangesVector{});
143
142
Kind = RangesWriterKind::DebugRangesWriter;
144
143
}
145
144
@@ -166,21 +165,20 @@ uint64_t DebugRangesSectionWriter::addRanges(DebugAddressRangesVector &Ranges) {
166
165
// Reading the SectionOffset and updating it should be atomic to guarantee
167
166
// unique and correct offsets in patches.
168
167
std::lock_guard<std::mutex> Lock (WriterMutex);
169
- const uint32_t EntryOffset = SectionOffset ;
170
- SectionOffset += writeAddressRanges (*RangesStream.get (), Ranges);
168
+ const uint32_t EntryOffset = RangesBuffer-> size () ;
169
+ writeAddressRanges (*RangesStream.get (), Ranges);
171
170
172
171
return EntryOffset;
173
172
}
174
173
175
174
uint64_t DebugRangesSectionWriter::getSectionOffset () {
176
175
std::lock_guard<std::mutex> Lock (WriterMutex);
177
- return SectionOffset ;
176
+ return RangesBuffer-> size () ;
178
177
}
179
178
180
179
void DebugRangesSectionWriter::appendToRangeBuffer (
181
180
const DebugBufferVector &CUBuffer) {
182
181
*RangesStream << CUBuffer;
183
- SectionOffset = RangesBuffer->size ();
184
182
}
185
183
186
184
DebugAddrWriter *DebugRangeListsSectionWriter::AddrWriter = nullptr ;
@@ -327,7 +325,6 @@ void DebugRangeListsSectionWriter::finalizeSection() {
327
325
*RangesStream << *Header;
328
326
*RangesStream << *CUArrayBuffer;
329
327
*RangesStream << *CUBodyBuffer;
330
- SectionOffset = RangesBuffer->size ();
331
328
}
332
329
333
330
void DebugRangeListsSectionWriter::initSection (DWARFUnit &Unit) {
0 commit comments