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 29 matching lines...) Expand all Loading... |
40 MinidumpModuleCodeViewRecordPDBLinkWriter< | 40 MinidumpModuleCodeViewRecordPDBLinkWriter< |
41 CodeViewRecordType>::~MinidumpModuleCodeViewRecordPDBLinkWriter() { | 41 CodeViewRecordType>::~MinidumpModuleCodeViewRecordPDBLinkWriter() { |
42 } | 42 } |
43 | 43 |
44 template <typename CodeViewRecordType> | 44 template <typename CodeViewRecordType> |
45 size_t | 45 size_t |
46 MinidumpModuleCodeViewRecordPDBLinkWriter<CodeViewRecordType>::SizeOfObject() { | 46 MinidumpModuleCodeViewRecordPDBLinkWriter<CodeViewRecordType>::SizeOfObject() { |
47 DCHECK_GE(state(), kStateFrozen); | 47 DCHECK_GE(state(), kStateFrozen); |
48 | 48 |
49 // NUL-terminate. | 49 // NUL-terminate. |
50 return offsetof(typeof(codeview_record_), pdb_name) + | 50 return offsetof(decltype(codeview_record_), pdb_name) + |
51 (pdb_name_.size() + 1) * sizeof(pdb_name_[0]); | 51 (pdb_name_.size() + 1) * sizeof(pdb_name_[0]); |
52 } | 52 } |
53 | 53 |
54 template <typename CodeViewRecordType> | 54 template <typename CodeViewRecordType> |
55 bool MinidumpModuleCodeViewRecordPDBLinkWriter<CodeViewRecordType>::WriteObject( | 55 bool MinidumpModuleCodeViewRecordPDBLinkWriter<CodeViewRecordType>::WriteObject( |
56 FileWriterInterface* file_writer) { | 56 FileWriterInterface* file_writer) { |
57 DCHECK_EQ(state(), kStateWritable); | 57 DCHECK_EQ(state(), kStateWritable); |
58 | 58 |
59 WritableIoVec iov; | 59 WritableIoVec iov; |
60 iov.iov_base = &codeview_record_; | 60 iov.iov_base = &codeview_record_; |
61 iov.iov_len = offsetof(typeof(codeview_record_), pdb_name); | 61 iov.iov_len = offsetof(decltype(codeview_record_), pdb_name); |
62 std::vector<WritableIoVec> iovecs(1, iov); | 62 std::vector<WritableIoVec> iovecs(1, iov); |
63 | 63 |
64 // NUL-terminate. | 64 // NUL-terminate. |
65 iov.iov_base = &pdb_name_[0]; | 65 iov.iov_base = &pdb_name_[0]; |
66 iov.iov_len = (pdb_name_.size() + 1) * sizeof(pdb_name_[0]); | 66 iov.iov_len = (pdb_name_.size() + 1) * sizeof(pdb_name_[0]); |
67 iovecs.push_back(iov); | 67 iovecs.push_back(iov); |
68 | 68 |
69 return file_writer->WriteIoVec(&iovecs); | 69 return file_writer->WriteIoVec(&iovecs); |
70 } | 70 } |
71 | 71 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 bool MinidumpModuleMiscDebugRecordWriter::Freeze() { | 124 bool MinidumpModuleMiscDebugRecordWriter::Freeze() { |
125 DCHECK_EQ(state(), kStateMutable); | 125 DCHECK_EQ(state(), kStateMutable); |
126 | 126 |
127 if (!MinidumpWritable::Freeze()) { | 127 if (!MinidumpWritable::Freeze()) { |
128 return false; | 128 return false; |
129 } | 129 } |
130 | 130 |
131 // NUL-terminate. | 131 // NUL-terminate. |
132 if (!image_debug_misc_.Unicode) { | 132 if (!image_debug_misc_.Unicode) { |
133 DCHECK(data_utf16_.empty()); | 133 DCHECK(data_utf16_.empty()); |
134 image_debug_misc_.Length = offsetof(typeof(image_debug_misc_), Data) + | 134 image_debug_misc_.Length = offsetof(decltype(image_debug_misc_), Data) + |
135 (data_.size() + 1) * sizeof(data_[0]); | 135 (data_.size() + 1) * sizeof(data_[0]); |
136 } else { | 136 } else { |
137 DCHECK(data_.empty()); | 137 DCHECK(data_.empty()); |
138 image_debug_misc_.Length = | 138 image_debug_misc_.Length = |
139 offsetof(typeof(image_debug_misc_), Data) + | 139 offsetof(decltype(image_debug_misc_), Data) + |
140 (data_utf16_.size() + 1) * sizeof(data_utf16_[0]); | 140 (data_utf16_.size() + 1) * sizeof(data_utf16_[0]); |
141 } | 141 } |
142 | 142 |
143 return true; | 143 return true; |
144 } | 144 } |
145 | 145 |
146 size_t MinidumpModuleMiscDebugRecordWriter::SizeOfObject() { | 146 size_t MinidumpModuleMiscDebugRecordWriter::SizeOfObject() { |
147 DCHECK_GE(state(), kStateFrozen); | 147 DCHECK_GE(state(), kStateFrozen); |
148 | 148 |
149 return image_debug_misc_.Length; | 149 return image_debug_misc_.Length; |
150 } | 150 } |
151 | 151 |
152 bool MinidumpModuleMiscDebugRecordWriter::WriteObject( | 152 bool MinidumpModuleMiscDebugRecordWriter::WriteObject( |
153 FileWriterInterface* file_writer) { | 153 FileWriterInterface* file_writer) { |
154 DCHECK_EQ(state(), kStateWritable); | 154 DCHECK_EQ(state(), kStateWritable); |
155 | 155 |
156 const size_t base_length = offsetof(typeof(image_debug_misc_), Data); | 156 const size_t base_length = offsetof(decltype(image_debug_misc_), Data); |
157 | 157 |
158 WritableIoVec iov; | 158 WritableIoVec iov; |
159 iov.iov_base = &image_debug_misc_; | 159 iov.iov_base = &image_debug_misc_; |
160 iov.iov_len = base_length; | 160 iov.iov_len = base_length; |
161 std::vector<WritableIoVec> iovecs(1, iov); | 161 std::vector<WritableIoVec> iovecs(1, iov); |
162 | 162 |
163 if (!image_debug_misc_.Unicode) { | 163 if (!image_debug_misc_.Unicode) { |
164 DCHECK(data_utf16_.empty()); | 164 DCHECK(data_utf16_.empty()); |
165 iov.iov_base = &data_[0]; | 165 iov.iov_base = &data_[0]; |
166 } else { | 166 } else { |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 371 } |
372 | 372 |
373 return file_writer->WriteIoVec(&iovecs); | 373 return file_writer->WriteIoVec(&iovecs); |
374 } | 374 } |
375 | 375 |
376 MinidumpStreamType MinidumpModuleListWriter::StreamType() const { | 376 MinidumpStreamType MinidumpModuleListWriter::StreamType() const { |
377 return kMinidumpStreamTypeModuleList; | 377 return kMinidumpStreamTypeModuleList; |
378 } | 378 } |
379 | 379 |
380 } // namespace crashpad | 380 } // namespace crashpad |
OLD | NEW |