minidump: Be consistent about setting the fields of WritableIoVec.

The iov_base field appears before the iov_len field, but for some
reason, sometimes the fields were being set in the reverse order.

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/678473003
This commit is contained in:
Mark Mentovai 2014-10-23 17:25:20 -04:00
parent 20f95a2f5b
commit dcdbd2098f
5 changed files with 8 additions and 10 deletions

View File

@ -150,8 +150,8 @@ bool MinidumpFileWriter::WriteObject(FileWriterInterface* file_writer) {
std::vector<WritableIoVec> iovecs(1, iov); std::vector<WritableIoVec> iovecs(1, iov);
for (internal::MinidumpStreamWriter* stream : streams_) { for (internal::MinidumpStreamWriter* stream : streams_) {
iov.iov_len = sizeof(MINIDUMP_DIRECTORY);
iov.iov_base = stream->DirectoryListEntry(); iov.iov_base = stream->DirectoryListEntry();
iov.iov_len = sizeof(MINIDUMP_DIRECTORY);
iovecs.push_back(iov); iovecs.push_back(iov);
} }

View File

@ -163,8 +163,8 @@ bool MinidumpMemoryListWriter::WriteObject(FileWriterInterface* file_writer) {
std::vector<WritableIoVec> iovecs(1, iov); std::vector<WritableIoVec> iovecs(1, iov);
for (const MinidumpMemoryWriter* memory_writer : memory_writers_) { for (const MinidumpMemoryWriter* memory_writer : memory_writers_) {
iov.iov_len = sizeof(MINIDUMP_MEMORY_DESCRIPTOR);
iov.iov_base = memory_writer->MinidumpMemoryDescriptor(); iov.iov_base = memory_writer->MinidumpMemoryDescriptor();
iov.iov_len = sizeof(MINIDUMP_MEMORY_DESCRIPTOR);
iovecs.push_back(iov); iovecs.push_back(iov);
} }

View File

@ -154,7 +154,6 @@ bool MinidumpModuleMiscDebugRecordWriter::WriteObject(
iov.iov_len = base_length; iov.iov_len = base_length;
std::vector<WritableIoVec> iovecs(1, iov); std::vector<WritableIoVec> iovecs(1, iov);
iov.iov_len = image_debug_misc_.Length - base_length;
if (!image_debug_misc_.Unicode) { if (!image_debug_misc_.Unicode) {
DCHECK(data_utf16_.empty()); DCHECK(data_utf16_.empty());
iov.iov_base = &data_[0]; iov.iov_base = &data_[0];
@ -162,6 +161,7 @@ bool MinidumpModuleMiscDebugRecordWriter::WriteObject(
DCHECK(data_.empty()); DCHECK(data_.empty());
iov.iov_base = &data_utf16_[0]; iov.iov_base = &data_utf16_[0];
} }
iov.iov_len = image_debug_misc_.Length - base_length;
iovecs.push_back(iov); iovecs.push_back(iov);
return file_writer->WriteIoVec(&iovecs); return file_writer->WriteIoVec(&iovecs);
@ -358,8 +358,8 @@ bool MinidumpModuleListWriter::WriteObject(FileWriterInterface* file_writer) {
std::vector<WritableIoVec> iovecs(1, iov); std::vector<WritableIoVec> iovecs(1, iov);
for (const MinidumpModuleWriter* module : modules_) { for (const MinidumpModuleWriter* module : modules_) {
iov.iov_len = sizeof(MINIDUMP_MODULE);
iov.iov_base = module->MinidumpModule(); iov.iov_base = module->MinidumpModule();
iov.iov_len = sizeof(MINIDUMP_MODULE);
iovecs.push_back(iov); iovecs.push_back(iov);
} }

View File

@ -144,12 +144,10 @@ bool MinidumpSimpleStringDictionaryWriter::WriteObject(
iov.iov_len = sizeof(simple_string_dictionary_base_); iov.iov_len = sizeof(simple_string_dictionary_base_);
std::vector<WritableIoVec> iovecs(1, iov); std::vector<WritableIoVec> iovecs(1, iov);
if (!entries_.empty()) { for (const auto& key_entry : entries_) {
iov.iov_base = key_entry.second->MinidumpSimpleStringDictionaryEntry();
iov.iov_len = sizeof(MinidumpSimpleStringDictionaryEntry); iov.iov_len = sizeof(MinidumpSimpleStringDictionaryEntry);
for (const auto& key_entry : entries_) { iovecs.push_back(iov);
iov.iov_base = key_entry.second->MinidumpSimpleStringDictionaryEntry();
iovecs.push_back(iov);
}
} }
return file_writer->WriteIoVec(&iovecs); return file_writer->WriteIoVec(&iovecs);

View File

@ -164,8 +164,8 @@ bool MinidumpThreadListWriter::WriteObject(FileWriterInterface* file_writer) {
std::vector<WritableIoVec> iovecs(1, iov); std::vector<WritableIoVec> iovecs(1, iov);
for (const MinidumpThreadWriter* thread : threads_) { for (const MinidumpThreadWriter* thread : threads_) {
iov.iov_len = sizeof(MINIDUMP_THREAD);
iov.iov_base = thread->MinidumpThread(); iov.iov_base = thread->MinidumpThread();
iov.iov_len = sizeof(MINIDUMP_THREAD);
iovecs.push_back(iov); iovecs.push_back(iov);
} }