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 #ifndef CRASHPAD_CLIENT_CRASHPAD_INFO_H_ | 15 #ifndef CRASHPAD_CLIENT_CRASHPAD_INFO_H_ |
16 #define CRASHPAD_CLIENT_CRASHPAD_INFO_H_ | 16 #define CRASHPAD_CLIENT_CRASHPAD_INFO_H_ |
17 | 17 |
18 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
19 | 19 |
20 #include <stdint.h> | 20 #include <stdint.h> |
21 | 21 |
| 22 #include "build/build_config.h" |
22 #include "client/simple_string_dictionary.h" | 23 #include "client/simple_string_dictionary.h" |
23 #include "util/misc/tri_state.h" | 24 #include "util/misc/tri_state.h" |
24 | 25 |
| 26 #if defined(OS_WIN) |
| 27 #include <windows.h> |
| 28 #endif // OS_WIN |
| 29 |
25 namespace crashpad { | 30 namespace crashpad { |
26 | 31 |
27 //! \brief A structure that can be used by a Crashpad-enabled program to | 32 //! \brief A structure that can be used by a Crashpad-enabled program to |
28 //! provide information to the Crashpad crash handler. | 33 //! provide information to the Crashpad crash handler. |
29 //! | 34 //! |
30 //! It is possible for one CrashpadInfo structure to appear in each loaded code | 35 //! It is possible for one CrashpadInfo structure to appear in each loaded code |
31 //! module in a process, but from the perspective of the user of the client | 36 //! module in a process, but from the perspective of the user of the client |
32 //! interface, there is only one global CrashpadInfo structure, located in the | 37 //! interface, there is only one global CrashpadInfo structure, located in the |
33 //! module that contains the client interface code. | 38 //! module that contains the client interface code. |
34 struct CrashpadInfo { | 39 struct CrashpadInfo { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 //! disabled by SetCrashpadHandlerState(). Even when forwarding is enabled, | 91 //! disabled by SetCrashpadHandlerState(). Even when forwarding is enabled, |
87 //! the Crashpad handler may choose not to forward all exceptions to the | 92 //! the Crashpad handler may choose not to forward all exceptions to the |
88 //! system’s crash reporter in cases where it has reason to believe that the | 93 //! system’s crash reporter in cases where it has reason to believe that the |
89 //! system’s crash reporter would not normally have handled the exception in | 94 //! system’s crash reporter would not normally have handled the exception in |
90 //! Crashpad’s absence. | 95 //! Crashpad’s absence. |
91 void set_system_crash_reporter_forwarding( | 96 void set_system_crash_reporter_forwarding( |
92 TriState system_crash_reporter_forwarding) { | 97 TriState system_crash_reporter_forwarding) { |
93 system_crash_reporter_forwarding_ = system_crash_reporter_forwarding; | 98 system_crash_reporter_forwarding_ = system_crash_reporter_forwarding; |
94 } | 99 } |
95 | 100 |
| 101 #if defined(OS_WIN) |
| 102 //! \brief Save an EXCEPTION_POINTERS record for the crash handler. |
| 103 void set_exception_pointers(EXCEPTION_POINTERS* exception_pointers) { |
| 104 exception_pointers_ = exception_pointers; |
| 105 } |
| 106 #endif // OS_WIN |
| 107 |
96 enum : uint32_t { | 108 enum : uint32_t { |
97 kSignature = 'CPad', | 109 kSignature = 'CPad', |
98 }; | 110 }; |
99 | 111 |
100 private: | 112 private: |
101 // The compiler won’t necessarily see anyone using these fields, but it | 113 // The compiler won’t necessarily see anyone using these fields, but it |
102 // shouldn’t warn about that. These fields aren’t intended for use by the | 114 // shouldn’t warn about that. These fields aren’t intended for use by the |
103 // process they’re found in, they’re supposed to be read by the crash | 115 // process they’re found in, they’re supposed to be read by the crash |
104 // reporting process. | 116 // reporting process. |
105 #if defined(__clang__) | 117 #if defined(__clang__) |
106 #pragma clang diagnostic push | 118 #pragma clang diagnostic push |
107 #pragma clang diagnostic ignored "-Wunused-private-field" | 119 #pragma clang diagnostic ignored "-Wunused-private-field" |
108 #endif | 120 #endif |
109 | 121 |
110 // Fields present in version 1: | 122 // Fields present in version 1: |
111 uint32_t signature_; // kSignature | 123 uint32_t signature_; // kSignature |
112 uint32_t size_; // The size of the entire CrashpadInfo structure. | 124 uint32_t size_; // The size of the entire CrashpadInfo structure. |
113 uint32_t version_; // kVersion | 125 uint32_t version_; // kVersion |
114 TriState crashpad_handler_behavior_; | 126 TriState crashpad_handler_behavior_; |
115 TriState system_crash_reporter_forwarding_; | 127 TriState system_crash_reporter_forwarding_; |
116 uint16_t padding_0_; | 128 uint16_t padding_0_; |
117 SimpleStringDictionary* simple_annotations_; // weak | 129 SimpleStringDictionary* simple_annotations_; // weak |
118 | 130 |
| 131 #if defined(OS_WIN) |
| 132 EXCEPTION_POINTERS* exception_pointers_; |
| 133 #endif // OS_WIN |
| 134 |
119 #if defined(__clang__) | 135 #if defined(__clang__) |
120 #pragma clang diagnostic pop | 136 #pragma clang diagnostic pop |
121 #endif | 137 #endif |
122 | 138 |
123 DISALLOW_COPY_AND_ASSIGN(CrashpadInfo); | 139 DISALLOW_COPY_AND_ASSIGN(CrashpadInfo); |
124 }; | 140 }; |
125 | 141 |
126 } // namespace crashpad | 142 } // namespace crashpad |
127 | 143 |
128 #endif // CRASHPAD_CLIENT_CRASHPAD_INFO_H_ | 144 #endif // CRASHPAD_CLIENT_CRASHPAD_INFO_H_ |
OLD | NEW |