Skip to content

Commit 6c0c5c6

Browse files
committed
Cleanup some comments and remove some unncessary usings from minidumpfilebuilder.cpp
1 parent 76d7227 commit 6c0c5c6

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,9 @@
4141

4242
#include <algorithm>
4343
#include <cinttypes>
44-
#include <climits>
4544
#include <cstddef>
4645
#include <cstdint>
47-
#include <functional>
48-
#include <iostream>
49-
#include <set>
5046
#include <utility>
51-
#include <vector>
5247

5348
using namespace lldb;
5449
using namespace lldb_private;
@@ -879,8 +874,8 @@ Status MinidumpFileBuilder::AddMemoryList() {
879874
// We apply a generous padding here so that the Directory, MemoryList and
880875
// Memory64List sections all begin in 32b addressable space.
881876
// Then anything overflow extends into 64b addressable space.
882-
// All core memeroy ranges will either container nothing on stacks only
883-
// or all the memory ranges including stacks
877+
// all_core_memory_vec will either contain all stack regions at this point,
878+
// or be empty if it's a stack only minidump.
884879
if (!all_core_memory_vec.empty())
885880
total_size += 256 + (all_core_memory_vec.size() *
886881
sizeof(llvm::minidump::MemoryDescriptor_64));
@@ -924,9 +919,9 @@ Status MinidumpFileBuilder::DumpHeader() const {
924919
header.StreamDirectoryRVA =
925920
static_cast<llvm::support::ulittle32_t>(HEADER_SIZE);
926921
header.Checksum = static_cast<llvm::support::ulittle32_t>(
927-
0u), // not used in most of the writers
928-
header.TimeDateStamp =
929-
static_cast<llvm::support::ulittle32_t>(std::time(nullptr));
922+
0u); // not used in most of the writers
923+
header.TimeDateStamp =
924+
static_cast<llvm::support::ulittle32_t>(std::time(nullptr));
930925
header.Flags =
931926
static_cast<llvm::support::ulittle64_t>(0u); // minidump normal flag
932927

@@ -987,10 +982,10 @@ Status MinidumpFileBuilder::ReadWriteMemoryInChunks(
987982
current_addr, bytes_read, error.AsCString());
988983

989984
// If we failed in a memory read, we would normally want to skip
990-
// this entire region, if we had already written to the minidump
985+
// this entire region. If we had already written to the minidump
991986
// file, we can't easily rewind that state.
992987
//
993-
// So if we do encounter an error while reading, we just return
988+
// So if we do encounter an error while reading, we return
994989
// immediately, any prior bytes read will still be included but
995990
// any bytes partially read before the error are ignored.
996991
return lldb_private::IterationAction::Stop;
@@ -1069,7 +1064,7 @@ MinidumpFileBuilder::AddMemoryList_32(std::vector<CoreFileMemoryRange> &ranges,
10691064
return error;
10701065

10711066
// If we completely failed to read this range
1072-
// we can just omit any of the book keeping.
1067+
// we can drop the memory range
10731068
if (bytes_read == 0)
10741069
continue;
10751070

@@ -1209,14 +1204,9 @@ MinidumpFileBuilder::AddMemoryList_64(std::vector<CoreFileMemoryRange> &ranges,
12091204
}
12101205

12111206
Status MinidumpFileBuilder::AddData(const void *data, uint64_t size) {
1212-
// This should also get chunked, because worst case we copy over a big
1213-
// object / memory range, say 5gb. In that case, we'd have to allocate 10gb
1214-
// 5 gb for the buffer we're copying from, and then 5gb for the buffer we're
1215-
// copying to. Which will be short lived and immedaitely go to disk, the goal
1216-
// here is to limit the number of bytes we need to host in memory at any given
1217-
// time.
1207+
// Append the data to the buffer, if the buffer spills over, flush it to disk
12181208
m_data.AppendData(data, size);
1219-
if (m_data.GetByteSize() > MAX_WRITE_CHUNK_SIZE)
1209+
if (m_data.GetByteSize() + size > MAX_WRITE_CHUNK_SIZE)
12201210
return FlushBufferToDisk();
12211211

12221212
return Status();

0 commit comments

Comments
 (0)