Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: minidump/minidump_module_writer.cc

Issue 678473003: minidump: Be consistent about setting the fields of WritableIoVec (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 FileWriterInterface* file_writer) { 147 FileWriterInterface* file_writer) {
148 DCHECK_EQ(state(), kStateWritable); 148 DCHECK_EQ(state(), kStateWritable);
149 149
150 const size_t base_length = offsetof(typeof(image_debug_misc_), Data); 150 const size_t base_length = offsetof(typeof(image_debug_misc_), Data);
151 151
152 WritableIoVec iov; 152 WritableIoVec iov;
153 iov.iov_base = &image_debug_misc_; 153 iov.iov_base = &image_debug_misc_;
154 iov.iov_len = base_length; 154 iov.iov_len = base_length;
155 std::vector<WritableIoVec> iovecs(1, iov); 155 std::vector<WritableIoVec> iovecs(1, iov);
156 156
157 iov.iov_len = image_debug_misc_.Length - base_length;
158 if (!image_debug_misc_.Unicode) { 157 if (!image_debug_misc_.Unicode) {
159 DCHECK(data_utf16_.empty()); 158 DCHECK(data_utf16_.empty());
160 iov.iov_base = &data_[0]; 159 iov.iov_base = &data_[0];
161 } else { 160 } else {
162 DCHECK(data_.empty()); 161 DCHECK(data_.empty());
163 iov.iov_base = &data_utf16_[0]; 162 iov.iov_base = &data_utf16_[0];
164 } 163 }
164 iov.iov_len = image_debug_misc_.Length - base_length;
165 iovecs.push_back(iov); 165 iovecs.push_back(iov);
166 166
167 return file_writer->WriteIoVec(&iovecs); 167 return file_writer->WriteIoVec(&iovecs);
168 } 168 }
169 169
170 MinidumpModuleWriter::MinidumpModuleWriter() 170 MinidumpModuleWriter::MinidumpModuleWriter()
171 : MinidumpWritable(), 171 : MinidumpWritable(),
172 module_(), 172 module_(),
173 name_(), 173 name_(),
174 codeview_record_(nullptr), 174 codeview_record_(nullptr),
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 351
352 bool MinidumpModuleListWriter::WriteObject(FileWriterInterface* file_writer) { 352 bool MinidumpModuleListWriter::WriteObject(FileWriterInterface* file_writer) {
353 DCHECK_EQ(state(), kStateWritable); 353 DCHECK_EQ(state(), kStateWritable);
354 354
355 WritableIoVec iov; 355 WritableIoVec iov;
356 iov.iov_base = &module_list_base_; 356 iov.iov_base = &module_list_base_;
357 iov.iov_len = sizeof(module_list_base_); 357 iov.iov_len = sizeof(module_list_base_);
358 std::vector<WritableIoVec> iovecs(1, iov); 358 std::vector<WritableIoVec> iovecs(1, iov);
359 359
360 for (const MinidumpModuleWriter* module : modules_) { 360 for (const MinidumpModuleWriter* module : modules_) {
361 iov.iov_base = module->MinidumpModule();
361 iov.iov_len = sizeof(MINIDUMP_MODULE); 362 iov.iov_len = sizeof(MINIDUMP_MODULE);
362 iov.iov_base = module->MinidumpModule();
363 iovecs.push_back(iov); 363 iovecs.push_back(iov);
364 } 364 }
365 365
366 return file_writer->WriteIoVec(&iovecs); 366 return file_writer->WriteIoVec(&iovecs);
367 } 367 }
368 368
369 MinidumpStreamType MinidumpModuleListWriter::StreamType() const { 369 MinidumpStreamType MinidumpModuleListWriter::StreamType() const {
370 return kMinidumpStreamTypeModuleList; 370 return kMinidumpStreamTypeModuleList;
371 } 371 }
372 372
373 } // namespace crashpad 373 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_memory_writer.cc ('k') | minidump/minidump_simple_string_dictionary_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698