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 //! disabled by SetCrashpadHandlerState(). Even when forwarding is enabled, | 91 //! disabled by SetCrashpadHandlerState(). Even when forwarding is enabled, |
92 //! 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 |
93 //! 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 |
94 //! 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 |
95 //! Crashpad’s absence. | 95 //! Crashpad’s absence. |
96 void set_system_crash_reporter_forwarding( | 96 void set_system_crash_reporter_forwarding( |
97 TriState system_crash_reporter_forwarding) { | 97 TriState system_crash_reporter_forwarding) { |
98 system_crash_reporter_forwarding_ = system_crash_reporter_forwarding; | 98 system_crash_reporter_forwarding_ = system_crash_reporter_forwarding; |
99 } | 99 } |
100 | 100 |
101 #if defined(OS_WIN) | |
102 //! \brief Save the crashing thread ID for the crash handler. | |
103 void set_thread_id(DWORD thread_id) { thread_id_ = thread_id; } | |
104 DWORD thread_id() const { return thread_id_; } | |
105 | |
106 //! \brief Save an `EXCEPTION_POINTERS` record for the crash handler. | |
107 void set_exception_pointers(EXCEPTION_POINTERS* exception_pointers) { | |
108 exception_pointers_ = exception_pointers; | |
109 } | |
110 EXCEPTION_POINTERS* exception_pointers() const { return exception_pointers_; } | |
111 #endif // OS_WIN | |
112 | |
113 enum : uint32_t { | 101 enum : uint32_t { |
114 kSignature = 'CPad', | 102 kSignature = 'CPad', |
115 }; | 103 }; |
116 | 104 |
117 private: | 105 private: |
118 // The compiler won’t necessarily see anyone using these fields, but it | 106 // The compiler won’t necessarily see anyone using these fields, but it |
119 // shouldn’t warn about that. These fields aren’t intended for use by the | 107 // shouldn’t warn about that. These fields aren’t intended for use by the |
120 // process they’re found in, they’re supposed to be read by the crash | 108 // process they’re found in, they’re supposed to be read by the crash |
121 // reporting process. | 109 // reporting process. |
122 #if defined(__clang__) | 110 #if defined(__clang__) |
123 #pragma clang diagnostic push | 111 #pragma clang diagnostic push |
124 #pragma clang diagnostic ignored "-Wunused-private-field" | 112 #pragma clang diagnostic ignored "-Wunused-private-field" |
125 #endif | 113 #endif |
126 | 114 |
127 // Fields present in version 1: | 115 // Fields present in version 1: |
128 uint32_t signature_; // kSignature | 116 uint32_t signature_; // kSignature |
129 uint32_t size_; // The size of the entire CrashpadInfo structure. | 117 uint32_t size_; // The size of the entire CrashpadInfo structure. |
130 uint32_t version_; // kVersion | 118 uint32_t version_; // kVersion |
131 TriState crashpad_handler_behavior_; | 119 TriState crashpad_handler_behavior_; |
132 TriState system_crash_reporter_forwarding_; | 120 TriState system_crash_reporter_forwarding_; |
133 uint16_t padding_0_; | 121 uint16_t padding_0_; |
134 SimpleStringDictionary* simple_annotations_; // weak | 122 SimpleStringDictionary* simple_annotations_; // weak |
135 | 123 |
136 #if defined(OS_WIN) | |
137 EXCEPTION_POINTERS* exception_pointers_; | |
138 DWORD thread_id_; | |
139 #endif // OS_WIN | |
140 | |
141 #if defined(__clang__) | 124 #if defined(__clang__) |
142 #pragma clang diagnostic pop | 125 #pragma clang diagnostic pop |
143 #endif | 126 #endif |
144 | 127 |
145 DISALLOW_COPY_AND_ASSIGN(CrashpadInfo); | 128 DISALLOW_COPY_AND_ASSIGN(CrashpadInfo); |
146 }; | 129 }; |
147 | 130 |
148 } // namespace crashpad | 131 } // namespace crashpad |
149 | 132 |
150 #endif // CRASHPAD_CLIENT_CRASHPAD_INFO_H_ | 133 #endif // CRASHPAD_CLIENT_CRASHPAD_INFO_H_ |
OLD | NEW |