OLD | NEW |
1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 (msg.pid != 0) && | 264 (msg.pid != 0) && |
265 (msg.dump_request_handle != NULL) && | 265 (msg.dump_request_handle != NULL) && |
266 (msg.dump_generated_handle != NULL) && | 266 (msg.dump_generated_handle != NULL) && |
267 (msg.server_alive_handle != NULL); | 267 (msg.server_alive_handle != NULL); |
268 } | 268 } |
269 | 269 |
270 bool CrashGenerationClient::IsRegistered() const { | 270 bool CrashGenerationClient::IsRegistered() const { |
271 return crash_event_ != NULL; | 271 return crash_event_ != NULL; |
272 } | 272 } |
273 | 273 |
274 bool CrashGenerationClient::RequestDump(EXCEPTION_POINTERS* ex_info) { | 274 bool CrashGenerationClient::RequestDump(EXCEPTION_POINTERS* ex_info, |
| 275 MDRawAssertionInfo* assert_info) { |
275 if (!IsRegistered()) { | 276 if (!IsRegistered()) { |
276 return false; | 277 return false; |
277 } | 278 } |
278 | 279 |
279 exception_pointers_ = ex_info; | 280 exception_pointers_ = ex_info; |
280 thread_id_ = GetCurrentThreadId(); | 281 thread_id_ = GetCurrentThreadId(); |
281 | 282 |
282 assert_info_.line = 0; | |
283 assert_info_.type = 0; | |
284 assert_info_.expression[0] = 0; | |
285 assert_info_.file[0] = 0; | |
286 assert_info_.function[0] = 0; | |
287 | |
288 return SignalCrashEventAndWait(); | |
289 } | |
290 | |
291 bool CrashGenerationClient::RequestDump(MDRawAssertionInfo* assert_info) { | |
292 if (!IsRegistered()) { | |
293 return false; | |
294 } | |
295 | |
296 exception_pointers_ = NULL; | |
297 | |
298 if (assert_info) { | 283 if (assert_info) { |
299 memcpy(&assert_info_, assert_info, sizeof(assert_info_)); | 284 memcpy(&assert_info_, assert_info, sizeof(assert_info_)); |
300 } else { | 285 } else { |
301 memset(&assert_info_, 0, sizeof(assert_info_)); | 286 memset(&assert_info_, 0, sizeof(assert_info_)); |
302 } | 287 } |
303 | 288 |
304 thread_id_ = GetCurrentThreadId(); | 289 return SignalCrashEventAndWait(); |
| 290 } |
305 | 291 |
306 return SignalCrashEventAndWait(); | 292 bool CrashGenerationClient::RequestDump(EXCEPTION_POINTERS* ex_info) { |
| 293 return RequestDump(ex_info, NULL); |
| 294 } |
| 295 |
| 296 bool CrashGenerationClient::RequestDump(MDRawAssertionInfo* assert_info) { |
| 297 return RequestDump(NULL, assert_info); |
307 } | 298 } |
308 | 299 |
309 bool CrashGenerationClient::SignalCrashEventAndWait() { | 300 bool CrashGenerationClient::SignalCrashEventAndWait() { |
310 assert(crash_event_); | 301 assert(crash_event_); |
311 assert(crash_generated_); | 302 assert(crash_generated_); |
312 assert(server_alive_); | 303 assert(server_alive_); |
313 | 304 |
314 // Reset the dump generated event before signaling the crash | 305 // Reset the dump generated event before signaling the crash |
315 // event so that the server can set the dump generated event | 306 // event so that the server can set the dump generated event |
316 // once it is done generating the event. | 307 // once it is done generating the event. |
(...skipping 11 matching lines...) Expand all Loading... |
328 wait_handles, | 319 wait_handles, |
329 FALSE, | 320 FALSE, |
330 kWaitForServerTimeoutMs); | 321 kWaitForServerTimeoutMs); |
331 | 322 |
332 // Crash dump was successfully generated only if the server | 323 // Crash dump was successfully generated only if the server |
333 // signaled the crash generated event. | 324 // signaled the crash generated event. |
334 return result == WAIT_OBJECT_0; | 325 return result == WAIT_OBJECT_0; |
335 } | 326 } |
336 | 327 |
337 } // namespace google_breakpad | 328 } // namespace google_breakpad |
OLD | NEW |