| 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 "client/crashpad_info.h" | 15 #include "client/crashpad_info.h" |
| 16 | 16 |
| 17 #include "util/misc/address_sanitizer.h" |
| 17 #include "util/stdlib/cxx.h" | 18 #include "util/stdlib/cxx.h" |
| 18 | 19 |
| 19 #if defined(OS_MACOSX) | 20 #if defined(OS_MACOSX) |
| 20 #include <mach-o/loader.h> | 21 #include <mach-o/loader.h> |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 #if CXX_LIBRARY_VERSION >= 2011 | 24 #if CXX_LIBRARY_VERSION >= 2011 |
| 24 #include <type_traits> | 25 #include <type_traits> |
| 25 #endif | 26 #endif |
| 26 | 27 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Put the structure in a well-known section name where it can be easily | 66 // Put the structure in a well-known section name where it can be easily |
| 66 // found without having to consult the symbol table. | 67 // found without having to consult the symbol table. |
| 67 #if defined(OS_MACOSX) | 68 #if defined(OS_MACOSX) |
| 68 section(SEG_DATA ",crashpad_info"), | 69 section(SEG_DATA ",crashpad_info"), |
| 69 #elif defined(OS_LINUX) || defined(OS_ANDROID) | 70 #elif defined(OS_LINUX) || defined(OS_ANDROID) |
| 70 section("crashpad_info"), | 71 section("crashpad_info"), |
| 71 #else // !defined(OS_MACOSX) && !defined(OS_LINUX) && !defined(OS_ANDROID) | 72 #else // !defined(OS_MACOSX) && !defined(OS_LINUX) && !defined(OS_ANDROID) |
| 72 #error Port | 73 #error Port |
| 73 #endif // !defined(OS_MACOSX) && !defined(OS_LINUX) && !defined(OS_ANDROID) | 74 #endif // !defined(OS_MACOSX) && !defined(OS_LINUX) && !defined(OS_ANDROID) |
| 74 | 75 |
| 75 #if __has_feature(address_sanitizer) | 76 #if defined(ADDRESS_SANITIZER) |
| 76 // AddressSanitizer would add a trailing red zone of at least 32 bytes, | 77 // AddressSanitizer would add a trailing red zone of at least 32 bytes, |
| 77 // which would be reflected in the size of the custom section. This confuses | 78 // which would be reflected in the size of the custom section. This confuses |
| 78 // MachOImageReader::GetCrashpadInfo(), which finds that the section’s size | 79 // MachOImageReader::GetCrashpadInfo(), which finds that the section’s size |
| 79 // disagrees with the structure’s size_ field. By specifying an alignment | 80 // disagrees with the structure’s size_ field. By specifying an alignment |
| 80 // greater than the red zone size, the red zone will be suppressed. | 81 // greater than the red zone size, the red zone will be suppressed. |
| 81 aligned(64), | 82 aligned(64), |
| 82 #endif // __has_feature(address_sanitizer) | 83 #endif // defined(ADDRESS_SANITIZER) |
| 83 | 84 |
| 84 // The “used” attribute prevents the structure from being dead-stripped. | 85 // The “used” attribute prevents the structure from being dead-stripped. |
| 85 used, | 86 used, |
| 86 | 87 |
| 87 // There’s no need to expose this as a public symbol from the symbol table. | 88 // There’s no need to expose this as a public symbol from the symbol table. |
| 88 // All accesses from the outside can locate the well-known section name. | 89 // All accesses from the outside can locate the well-known section name. |
| 89 visibility("hidden"))) | 90 visibility("hidden"))) |
| 90 | 91 |
| 91 #elif defined(OS_WIN) | 92 #elif defined(OS_WIN) |
| 92 | 93 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 to_be_added->next = base::checked_cast<uint64_t>( | 134 to_be_added->next = base::checked_cast<uint64_t>( |
| 134 reinterpret_cast<uintptr_t>(user_data_minidump_stream_head_)); | 135 reinterpret_cast<uintptr_t>(user_data_minidump_stream_head_)); |
| 135 to_be_added->stream_type = stream_type; | 136 to_be_added->stream_type = stream_type; |
| 136 to_be_added->base_address = | 137 to_be_added->base_address = |
| 137 base::checked_cast<uint64_t>(reinterpret_cast<uintptr_t>(data)); | 138 base::checked_cast<uint64_t>(reinterpret_cast<uintptr_t>(data)); |
| 138 to_be_added->size = base::checked_cast<uint64_t>(size); | 139 to_be_added->size = base::checked_cast<uint64_t>(size); |
| 139 user_data_minidump_stream_head_ = to_be_added; | 140 user_data_minidump_stream_head_ = to_be_added; |
| 140 } | 141 } |
| 141 | 142 |
| 142 } // namespace crashpad | 143 } // namespace crashpad |
| OLD | NEW |