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, |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "minidump/minidump_exception_writer.h" | 21 #include "minidump/minidump_exception_writer.h" |
22 #include "minidump/minidump_handle_writer.h" | 22 #include "minidump/minidump_handle_writer.h" |
23 #include "minidump/minidump_memory_info_writer.h" | 23 #include "minidump/minidump_memory_info_writer.h" |
24 #include "minidump/minidump_memory_writer.h" | 24 #include "minidump/minidump_memory_writer.h" |
25 #include "minidump/minidump_misc_info_writer.h" | 25 #include "minidump/minidump_misc_info_writer.h" |
26 #include "minidump/minidump_module_writer.h" | 26 #include "minidump/minidump_module_writer.h" |
27 #include "minidump/minidump_system_info_writer.h" | 27 #include "minidump/minidump_system_info_writer.h" |
28 #include "minidump/minidump_thread_id_map.h" | 28 #include "minidump/minidump_thread_id_map.h" |
29 #include "minidump/minidump_thread_writer.h" | 29 #include "minidump/minidump_thread_writer.h" |
30 #include "minidump/minidump_writer_util.h" | 30 #include "minidump/minidump_writer_util.h" |
| 31 #include "snapshot/exception_snapshot.h" |
31 #include "snapshot/process_snapshot.h" | 32 #include "snapshot/process_snapshot.h" |
32 #include "util/file/file_writer.h" | 33 #include "util/file/file_writer.h" |
33 #include "util/numeric/safe_assignment.h" | 34 #include "util/numeric/safe_assignment.h" |
34 | 35 |
35 namespace crashpad { | 36 namespace crashpad { |
36 | 37 |
37 MinidumpFileWriter::MinidumpFileWriter() | 38 MinidumpFileWriter::MinidumpFileWriter() |
38 : MinidumpWritable(), header_(), streams_(), stream_types_() { | 39 : MinidumpWritable(), header_(), streams_(), stream_types_() { |
39 // Don’t set the signature field right away. Leave it set to 0, so that a | 40 // Don’t set the signature field right away. Leave it set to 0, so that a |
40 // partially-written minidump file isn’t confused for a complete and valid | 41 // partially-written minidump file isn’t confused for a complete and valid |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 113 } |
113 | 114 |
114 std::vector<HandleSnapshot> handles_snapshot = process_snapshot->Handles(); | 115 std::vector<HandleSnapshot> handles_snapshot = process_snapshot->Handles(); |
115 if (!handles_snapshot.empty()) { | 116 if (!handles_snapshot.empty()) { |
116 auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter()); | 117 auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter()); |
117 handle_data_writer->InitializeFromSnapshot(handles_snapshot); | 118 handle_data_writer->InitializeFromSnapshot(handles_snapshot); |
118 AddStream(std::move(handle_data_writer)); | 119 AddStream(std::move(handle_data_writer)); |
119 } | 120 } |
120 | 121 |
121 memory_list->AddFromSnapshot(process_snapshot->ExtraMemory()); | 122 memory_list->AddFromSnapshot(process_snapshot->ExtraMemory()); |
| 123 if (exception_snapshot) |
| 124 memory_list->AddFromSnapshot(exception_snapshot->ExtraMemory()); |
122 | 125 |
123 AddStream(std::move(memory_list)); | 126 AddStream(std::move(memory_list)); |
124 } | 127 } |
125 | 128 |
126 void MinidumpFileWriter::SetTimestamp(time_t timestamp) { | 129 void MinidumpFileWriter::SetTimestamp(time_t timestamp) { |
127 DCHECK_EQ(state(), kStateMutable); | 130 DCHECK_EQ(state(), kStateMutable); |
128 | 131 |
129 internal::MinidumpWriterUtil::AssignTimeT(&header_.TimeDateStamp, timestamp); | 132 internal::MinidumpWriterUtil::AssignTimeT(&header_.TimeDateStamp, timestamp); |
130 } | 133 } |
131 | 134 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 for (internal::MinidumpStreamWriter* stream : streams_) { | 244 for (internal::MinidumpStreamWriter* stream : streams_) { |
242 iov.iov_base = stream->DirectoryListEntry(); | 245 iov.iov_base = stream->DirectoryListEntry(); |
243 iov.iov_len = sizeof(MINIDUMP_DIRECTORY); | 246 iov.iov_len = sizeof(MINIDUMP_DIRECTORY); |
244 iovecs.push_back(iov); | 247 iovecs.push_back(iov); |
245 } | 248 } |
246 | 249 |
247 return file_writer->WriteIoVec(&iovecs); | 250 return file_writer->WriteIoVec(&iovecs); |
248 } | 251 } |
249 | 252 |
250 } // namespace crashpad | 253 } // namespace crashpad |
OLD | NEW |