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

Side by Side Diff: minidump/minidump_file_writer.cc

Issue 1419623003: Write MINIDUMP_HANDLE_DATA_STREAM to minidump (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 2 months 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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "minidump/minidump_file_writer.h" 15 #include "minidump/minidump_file_writer.h"
16 16
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "minidump/minidump_crashpad_info_writer.h" 18 #include "minidump/minidump_crashpad_info_writer.h"
19 #include "minidump/minidump_exception_writer.h" 19 #include "minidump/minidump_exception_writer.h"
20 #include "minidump/minidump_handle_writer.h"
20 #include "minidump/minidump_memory_info_writer.h" 21 #include "minidump/minidump_memory_info_writer.h"
21 #include "minidump/minidump_memory_writer.h" 22 #include "minidump/minidump_memory_writer.h"
22 #include "minidump/minidump_misc_info_writer.h" 23 #include "minidump/minidump_misc_info_writer.h"
23 #include "minidump/minidump_module_writer.h" 24 #include "minidump/minidump_module_writer.h"
24 #include "minidump/minidump_system_info_writer.h" 25 #include "minidump/minidump_system_info_writer.h"
25 #include "minidump/minidump_thread_id_map.h" 26 #include "minidump/minidump_thread_id_map.h"
26 #include "minidump/minidump_thread_writer.h" 27 #include "minidump/minidump_thread_writer.h"
27 #include "minidump/minidump_writer_util.h" 28 #include "minidump/minidump_writer_util.h"
28 #include "snapshot/process_snapshot.h" 29 #include "snapshot/process_snapshot.h"
29 #include "util/file/file_writer.h" 30 #include "util/file/file_writer.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 102 }
102 103
103 std::vector<const MemoryMapRegionSnapshot*> memory_map_snapshot = 104 std::vector<const MemoryMapRegionSnapshot*> memory_map_snapshot =
104 process_snapshot->MemoryMap(); 105 process_snapshot->MemoryMap();
105 if (!memory_map_snapshot.empty()) { 106 if (!memory_map_snapshot.empty()) {
106 auto memory_info_list = make_scoped_ptr(new MinidumpMemoryInfoListWriter()); 107 auto memory_info_list = make_scoped_ptr(new MinidumpMemoryInfoListWriter());
107 memory_info_list->InitializeFromSnapshot(memory_map_snapshot); 108 memory_info_list->InitializeFromSnapshot(memory_map_snapshot);
108 AddStream(memory_info_list.Pass()); 109 AddStream(memory_info_list.Pass());
109 } 110 }
110 111
112 std::vector<HandleSnapshot> handles_snapshot = process_snapshot->Handles();
113 if (!handles_snapshot.empty()) {
114 auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter());
115 handle_data_writer->InitializeFromSnapshot(handles_snapshot);
116 AddStream(handle_data_writer.Pass());
117 }
118
111 memory_list->AddFromSnapshot(process_snapshot->ExtraMemory()); 119 memory_list->AddFromSnapshot(process_snapshot->ExtraMemory());
112 120
113 AddStream(memory_list.Pass()); 121 AddStream(memory_list.Pass());
114 } 122 }
115 123
116 void MinidumpFileWriter::SetTimestamp(time_t timestamp) { 124 void MinidumpFileWriter::SetTimestamp(time_t timestamp) {
117 DCHECK_EQ(state(), kStateMutable); 125 DCHECK_EQ(state(), kStateMutable);
118 126
119 internal::MinidumpWriterUtil::AssignTimeT(&header_.TimeDateStamp, timestamp); 127 internal::MinidumpWriterUtil::AssignTimeT(&header_.TimeDateStamp, timestamp);
120 } 128 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 for (internal::MinidumpStreamWriter* stream : streams_) { 239 for (internal::MinidumpStreamWriter* stream : streams_) {
232 iov.iov_base = stream->DirectoryListEntry(); 240 iov.iov_base = stream->DirectoryListEntry();
233 iov.iov_len = sizeof(MINIDUMP_DIRECTORY); 241 iov.iov_len = sizeof(MINIDUMP_DIRECTORY);
234 iovecs.push_back(iov); 242 iovecs.push_back(iov);
235 } 243 }
236 244
237 return file_writer->WriteIoVec(&iovecs); 245 return file_writer->WriteIoVec(&iovecs);
238 } 246 }
239 247
240 } // namespace crashpad 248 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698