| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 MINIDUMP_ALLOW_OVERSIZED_DATA(MINIDUMP_MODULE_LIST); | 91 MINIDUMP_ALLOW_OVERSIZED_DATA(MINIDUMP_MODULE_LIST); |
| 92 MINIDUMP_ALLOW_OVERSIZED_DATA(MINIDUMP_THREAD_LIST); | 92 MINIDUMP_ALLOW_OVERSIZED_DATA(MINIDUMP_THREAD_LIST); |
| 93 MINIDUMP_ALLOW_OVERSIZED_DATA(MinidumpModuleCrashpadInfoList); | 93 MINIDUMP_ALLOW_OVERSIZED_DATA(MinidumpModuleCrashpadInfoList); |
| 94 MINIDUMP_ALLOW_OVERSIZED_DATA(MinidumpRVAList); | 94 MINIDUMP_ALLOW_OVERSIZED_DATA(MinidumpRVAList); |
| 95 MINIDUMP_ALLOW_OVERSIZED_DATA(MinidumpSimpleStringDictionary); | 95 MINIDUMP_ALLOW_OVERSIZED_DATA(MinidumpSimpleStringDictionary); |
| 96 | 96 |
| 97 // These types have final fields carrying variable-sized data (typically string | 97 // These types have final fields carrying variable-sized data (typically string |
| 98 // data). | 98 // data). |
| 99 MINIDUMP_ALLOW_OVERSIZED_DATA(IMAGE_DEBUG_MISC); | 99 MINIDUMP_ALLOW_OVERSIZED_DATA(IMAGE_DEBUG_MISC); |
| 100 MINIDUMP_ALLOW_OVERSIZED_DATA(MINIDUMP_STRING); | 100 MINIDUMP_ALLOW_OVERSIZED_DATA(MINIDUMP_STRING); |
| 101 MINIDUMP_ALLOW_OVERSIZED_DATA(MinidumpModuleCodeViewRecordPDB20); | 101 MINIDUMP_ALLOW_OVERSIZED_DATA(CodeViewRecordPDB20); |
| 102 MINIDUMP_ALLOW_OVERSIZED_DATA(MinidumpModuleCodeViewRecordPDB70); | 102 MINIDUMP_ALLOW_OVERSIZED_DATA(CodeViewRecordPDB70); |
| 103 MINIDUMP_ALLOW_OVERSIZED_DATA(MinidumpUTF8String); | 103 MINIDUMP_ALLOW_OVERSIZED_DATA(MinidumpUTF8String); |
| 104 | 104 |
| 105 // minidump_file_writer_test accesses its variable-sized test streams via a | 105 // minidump_file_writer_test accesses its variable-sized test streams via a |
| 106 // uint8_t*. | 106 // uint8_t*. |
| 107 MINIDUMP_ALLOW_OVERSIZED_DATA(uint8_t); | 107 MINIDUMP_ALLOW_OVERSIZED_DATA(uint8_t); |
| 108 | 108 |
| 109 #undef MINIDUMP_ALLOW_OVERSIZED_DATA | 109 #undef MINIDUMP_ALLOW_OVERSIZED_DATA |
| 110 | 110 |
| 111 //! \brief Returns a typed minidump object located within a minidump file’s | 111 //! \brief Returns a typed minidump object located within a minidump file’s |
| 112 //! contents, where the offset and size of the object are known. | 112 //! contents, where the offset and size of the object are known. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 135 //! | 135 //! |
| 136 //! This function has template specializations that perform more stringent | 136 //! This function has template specializations that perform more stringent |
| 137 //! checking than the default implementation: | 137 //! checking than the default implementation: |
| 138 //! - With a MINIDUMP_HEADER template parameter, a template specialization | 138 //! - With a MINIDUMP_HEADER template parameter, a template specialization |
| 139 //! ensures that the structure’s magic number and version fields are correct. | 139 //! ensures that the structure’s magic number and version fields are correct. |
| 140 //! - With a MINIDUMP_MEMORY_LIST, MINIDUMP_THREAD_LIST, MINIDUMP_MODULE_LIST, | 140 //! - With a MINIDUMP_MEMORY_LIST, MINIDUMP_THREAD_LIST, MINIDUMP_MODULE_LIST, |
| 141 //! or MinidumpSimpleStringDictionary template parameter, template | 141 //! or MinidumpSimpleStringDictionary template parameter, template |
| 142 //! specializations ensure that the size given by \a location matches the | 142 //! specializations ensure that the size given by \a location matches the |
| 143 //! size expected of a stream containing the number of elements it claims to | 143 //! size expected of a stream containing the number of elements it claims to |
| 144 //! have. | 144 //! have. |
| 145 //! - With an IMAGE_DEBUG_MISC, MinidumpModuleCodeViewRecordPDB20, or | 145 //! - With an IMAGE_DEBUG_MISC, CodeViewRecordPDB20, or CodeViewRecordPDB70 |
| 146 //! MinidumpModuleCodeViewRecordPDB70 template parameter, template | 146 //! template parameter, template specializations ensure that the structure |
| 147 //! specializations ensure that the structure has the expected format | 147 //! has the expected format including any magic number and the `NUL`- |
| 148 //! including any magic number and the `NUL`-terminated string. | 148 //! terminated string. |
| 149 //! | 149 //! |
| 150 //! \param[in] file_contents The contents of the minidump file. | 150 //! \param[in] file_contents The contents of the minidump file. |
| 151 //! \param[in] location A MINIDUMP_LOCATION_DESCRIPTOR giving the offset within | 151 //! \param[in] location A MINIDUMP_LOCATION_DESCRIPTOR giving the offset within |
| 152 //! the minidump file of the desired object, as well as its size. | 152 //! the minidump file of the desired object, as well as its size. |
| 153 //! | 153 //! |
| 154 //! \return If the size of \a location is at least as big as the size of the | 154 //! \return If the size of \a location is at least as big as the size of the |
| 155 //! requested object, and if \a location is within the range of \a | 155 //! requested object, and if \a location is within the range of \a |
| 156 //! file_contents, returns a pointer into \a file_contents at offset \a rva. | 156 //! file_contents, returns a pointer into \a file_contents at offset \a rva. |
| 157 //! Otherwise, raises a gtest assertion failure and returns `nullptr`. | 157 //! Otherwise, raises a gtest assertion failure and returns `nullptr`. |
| 158 //! | 158 //! |
| (...skipping 24 matching lines...) Expand all Loading... |
| 183 const MINIDUMP_MODULE_LIST* MinidumpWritableAtLocationDescriptor< | 183 const MINIDUMP_MODULE_LIST* MinidumpWritableAtLocationDescriptor< |
| 184 MINIDUMP_MODULE_LIST>(const std::string& file_contents, | 184 MINIDUMP_MODULE_LIST>(const std::string& file_contents, |
| 185 const MINIDUMP_LOCATION_DESCRIPTOR& location); | 185 const MINIDUMP_LOCATION_DESCRIPTOR& location); |
| 186 | 186 |
| 187 template <> | 187 template <> |
| 188 const MINIDUMP_THREAD_LIST* MinidumpWritableAtLocationDescriptor< | 188 const MINIDUMP_THREAD_LIST* MinidumpWritableAtLocationDescriptor< |
| 189 MINIDUMP_THREAD_LIST>(const std::string& file_contents, | 189 MINIDUMP_THREAD_LIST>(const std::string& file_contents, |
| 190 const MINIDUMP_LOCATION_DESCRIPTOR& location); | 190 const MINIDUMP_LOCATION_DESCRIPTOR& location); |
| 191 | 191 |
| 192 template <> | 192 template <> |
| 193 const MinidumpModuleCodeViewRecordPDB20* | 193 const CodeViewRecordPDB20* MinidumpWritableAtLocationDescriptor< |
| 194 MinidumpWritableAtLocationDescriptor<MinidumpModuleCodeViewRecordPDB20>( | 194 CodeViewRecordPDB20>(const std::string& file_contents, |
| 195 const std::string& file_contents, | 195 const MINIDUMP_LOCATION_DESCRIPTOR& location); |
| 196 const MINIDUMP_LOCATION_DESCRIPTOR& location); | |
| 197 | 196 |
| 198 template <> | 197 template <> |
| 199 const MinidumpModuleCodeViewRecordPDB70* | 198 const CodeViewRecordPDB70* MinidumpWritableAtLocationDescriptor< |
| 200 MinidumpWritableAtLocationDescriptor<MinidumpModuleCodeViewRecordPDB70>( | 199 CodeViewRecordPDB70>(const std::string& file_contents, |
| 201 const std::string& file_contents, | 200 const MINIDUMP_LOCATION_DESCRIPTOR& location); |
| 202 const MINIDUMP_LOCATION_DESCRIPTOR& location); | |
| 203 | 201 |
| 204 template <> | 202 template <> |
| 205 const MinidumpModuleCrashpadInfoList* | 203 const MinidumpModuleCrashpadInfoList* |
| 206 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfoList>( | 204 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfoList>( |
| 207 const std::string& file_contents, | 205 const std::string& file_contents, |
| 208 const MINIDUMP_LOCATION_DESCRIPTOR& location); | 206 const MINIDUMP_LOCATION_DESCRIPTOR& location); |
| 209 | 207 |
| 210 template <> | 208 template <> |
| 211 const MinidumpSimpleStringDictionary* | 209 const MinidumpSimpleStringDictionary* |
| 212 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( | 210 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 private: | 247 private: |
| 250 uint32_t value_; | 248 uint32_t value_; |
| 251 | 249 |
| 252 DISALLOW_COPY_AND_ASSIGN(TestUInt32MinidumpWritable); | 250 DISALLOW_COPY_AND_ASSIGN(TestUInt32MinidumpWritable); |
| 253 }; | 251 }; |
| 254 | 252 |
| 255 } // namespace test | 253 } // namespace test |
| 256 } // namespace crashpad | 254 } // namespace crashpad |
| 257 | 255 |
| 258 #endif // CRASHPAD_MINIDUMP_TEST_MINIDUMP_WRITABLE_TEST_UTIL_H_ | 256 #endif // CRASHPAD_MINIDUMP_TEST_MINIDUMP_WRITABLE_TEST_UTIL_H_ |
| OLD | NEW |