OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // handler, com.apple.ReportCrash.root, which invokes spindump to handle | 118 // handler, com.apple.ReportCrash.root, which invokes spindump to handle |
119 // them. These non-fatal exceptions are never user-visible and are not | 119 // them. These non-fatal exceptions are never user-visible and are not |
120 // currently of interest to Crashpad. Returning success here gets the | 120 // currently of interest to Crashpad. Returning success here gets the |
121 // process going again quickly, without generating a crash report. | 121 // process going again quickly, without generating a crash report. |
122 // | 122 // |
123 // Alternatively, this could return KERN_FAILURE to let the exception go to | 123 // Alternatively, this could return KERN_FAILURE to let the exception go to |
124 // the host-level handler, but there doesn’t seem to be much value in doing | 124 // the host-level handler, but there doesn’t seem to be much value in doing |
125 // so. | 125 // so. |
126 ExcServerCopyState( | 126 ExcServerCopyState( |
127 behavior, old_state, old_state_count, new_state, new_state_count); | 127 behavior, old_state, old_state_count, new_state, new_state_count); |
128 return ExcServerSuccessfulReturnValue(behavior, false); | 128 return ExcServerSuccessfulReturnValue(exception, behavior, false); |
129 } | 129 } |
130 | 130 |
131 CrashpadInfoClientOptions client_options; | 131 CrashpadInfoClientOptions client_options; |
132 process_snapshot.GetCrashpadOptions(&client_options); | 132 process_snapshot.GetCrashpadOptions(&client_options); |
133 | 133 |
134 if (client_options.crashpad_handler_behavior != TriState::kDisabled) { | 134 if (client_options.crashpad_handler_behavior != TriState::kDisabled) { |
135 if (!process_snapshot.InitializeException(behavior, | 135 if (!process_snapshot.InitializeException(behavior, |
136 thread, | 136 thread, |
137 exception, | 137 exception, |
138 code, | 138 code, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 UUID uuid; | 180 UUID uuid; |
181 database_status = database_->FinishedWritingCrashReport(new_report, &uuid); | 181 database_status = database_->FinishedWritingCrashReport(new_report, &uuid); |
182 if (database_status != CrashReportDatabase::kNoError) { | 182 if (database_status != CrashReportDatabase::kNoError) { |
183 return KERN_FAILURE; | 183 return KERN_FAILURE; |
184 } | 184 } |
185 | 185 |
186 upload_thread_->ReportPending(); | 186 upload_thread_->ReportPending(); |
187 } | 187 } |
188 | 188 |
189 bool forwarded = false; | |
190 if (client_options.system_crash_reporter_forwarding != TriState::kDisabled && | 189 if (client_options.system_crash_reporter_forwarding != TriState::kDisabled && |
191 (exception == EXC_CRASH || | 190 (exception == EXC_CRASH || |
192 exception == EXC_RESOURCE || | 191 exception == EXC_RESOURCE || |
193 exception == EXC_GUARD)) { | 192 exception == EXC_GUARD)) { |
194 // Don’t forward simulated exceptions such as kMachExceptionSimulated to the | 193 // Don’t forward simulated exceptions such as kMachExceptionSimulated to the |
195 // system crash reporter. Only forward the types of exceptions that it would | 194 // system crash reporter. Only forward the types of exceptions that it would |
196 // receive under normal conditions. Although the system crash reporter is | 195 // receive under normal conditions. Although the system crash reporter is |
197 // able to deal with other exceptions including simulated ones, forwarding | 196 // able to deal with other exceptions including simulated ones, forwarding |
198 // them to the system crash reporter could present the system’s crash UI for | 197 // them to the system crash reporter could present the system’s crash UI for |
199 // processes that haven’t actually crashed, and could result in reports not | 198 // processes that haven’t actually crashed, and could result in reports not |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 thread, | 233 thread, |
235 task, | 234 task, |
236 exception, | 235 exception, |
237 code, | 236 code, |
238 code_count, | 237 code_count, |
239 &flavor_forward, | 238 &flavor_forward, |
240 old_state, | 239 old_state, |
241 old_state_count, | 240 old_state_count, |
242 new_state_forward_count ? &new_state_forward[0] : nullptr, | 241 new_state_forward_count ? &new_state_forward[0] : nullptr, |
243 &new_state_forward_count); | 242 &new_state_forward_count); |
244 if (kr == KERN_SUCCESS) { | 243 MACH_LOG_IF(WARNING, kr != KERN_SUCCESS, kr) |
245 forwarded = true; | 244 << "UniversalExceptionRaise " << kSystemCrashReporterServiceName; |
246 } else { | |
247 MACH_LOG(WARNING, kr) | |
248 << "UniversalExceptionRaise " << kSystemCrashReporterServiceName; | |
249 } | |
250 } | 245 } |
251 } | 246 } |
252 | 247 |
253 if (!forwarded) { | 248 ExcServerCopyState( |
254 ExcServerCopyState( | 249 behavior, old_state, old_state_count, new_state, new_state_count); |
255 behavior, old_state, old_state_count, new_state, new_state_count); | |
256 } | |
257 | 250 |
258 return ExcServerSuccessfulReturnValue(behavior, false); | 251 return ExcServerSuccessfulReturnValue(exception, behavior, false); |
259 } | 252 } |
260 | 253 |
261 } // namespace crashpad | 254 } // namespace crashpad |
OLD | NEW |