OLD | NEW |
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_memory_info_writer.h" |
20 #include "minidump/minidump_memory_writer.h" | 21 #include "minidump/minidump_memory_writer.h" |
21 #include "minidump/minidump_misc_info_writer.h" | 22 #include "minidump/minidump_misc_info_writer.h" |
22 #include "minidump/minidump_module_writer.h" | 23 #include "minidump/minidump_module_writer.h" |
23 #include "minidump/minidump_system_info_writer.h" | 24 #include "minidump/minidump_system_info_writer.h" |
24 #include "minidump/minidump_thread_id_map.h" | 25 #include "minidump/minidump_thread_id_map.h" |
25 #include "minidump/minidump_thread_writer.h" | 26 #include "minidump/minidump_thread_writer.h" |
26 #include "minidump/minidump_writer_util.h" | 27 #include "minidump/minidump_writer_util.h" |
27 #include "snapshot/process_snapshot.h" | 28 #include "snapshot/process_snapshot.h" |
28 #include "util/file/file_writer.h" | 29 #include "util/file/file_writer.h" |
29 #include "util/numeric/safe_assignment.h" | 30 #include "util/numeric/safe_assignment.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 93 |
93 auto crashpad_info = make_scoped_ptr(new MinidumpCrashpadInfoWriter()); | 94 auto crashpad_info = make_scoped_ptr(new MinidumpCrashpadInfoWriter()); |
94 crashpad_info->InitializeFromSnapshot(process_snapshot); | 95 crashpad_info->InitializeFromSnapshot(process_snapshot); |
95 | 96 |
96 // Since the MinidumpCrashpadInfo stream is an extension, it’s safe to not add | 97 // Since the MinidumpCrashpadInfo stream is an extension, it’s safe to not add |
97 // it to the minidump file if it wouldn’t carry any useful information. | 98 // it to the minidump file if it wouldn’t carry any useful information. |
98 if (crashpad_info->IsUseful()) { | 99 if (crashpad_info->IsUseful()) { |
99 AddStream(crashpad_info.Pass()); | 100 AddStream(crashpad_info.Pass()); |
100 } | 101 } |
101 | 102 |
| 103 std::vector<const MemoryMapRegionSnapshot*> memory_map_snapshot = |
| 104 process_snapshot->MemoryMap(); |
| 105 if (!memory_map_snapshot.empty()) { |
| 106 auto memory_info_list = make_scoped_ptr(new MinidumpMemoryInfoListWriter()); |
| 107 memory_info_list->InitializeFromSnapshot(memory_map_snapshot); |
| 108 AddStream(memory_info_list.Pass()); |
| 109 } |
| 110 |
102 memory_list->AddFromSnapshot(process_snapshot->ExtraMemory()); | 111 memory_list->AddFromSnapshot(process_snapshot->ExtraMemory()); |
103 | 112 |
104 AddStream(memory_list.Pass()); | 113 AddStream(memory_list.Pass()); |
105 } | 114 } |
106 | 115 |
107 void MinidumpFileWriter::SetTimestamp(time_t timestamp) { | 116 void MinidumpFileWriter::SetTimestamp(time_t timestamp) { |
108 DCHECK_EQ(state(), kStateMutable); | 117 DCHECK_EQ(state(), kStateMutable); |
109 | 118 |
110 internal::MinidumpWriterUtil::AssignTimeT(&header_.TimeDateStamp, timestamp); | 119 internal::MinidumpWriterUtil::AssignTimeT(&header_.TimeDateStamp, timestamp); |
111 } | 120 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 for (internal::MinidumpStreamWriter* stream : streams_) { | 231 for (internal::MinidumpStreamWriter* stream : streams_) { |
223 iov.iov_base = stream->DirectoryListEntry(); | 232 iov.iov_base = stream->DirectoryListEntry(); |
224 iov.iov_len = sizeof(MINIDUMP_DIRECTORY); | 233 iov.iov_len = sizeof(MINIDUMP_DIRECTORY); |
225 iovecs.push_back(iov); | 234 iovecs.push_back(iov); |
226 } | 235 } |
227 | 236 |
228 return file_writer->WriteIoVec(&iovecs); | 237 return file_writer->WriteIoVec(&iovecs); |
229 } | 238 } |
230 | 239 |
231 } // namespace crashpad | 240 } // namespace crashpad |
OLD | NEW |