OLD | NEW |
1 // Copyright (c) 2010 Google Inc. | 1 // Copyright (c) 2010 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 // previously installed handler. Then, when the signal is retriggered, it will | 358 // previously installed handler. Then, when the signal is retriggered, it will |
359 // be delivered to the appropriate handler. | 359 // be delivered to the appropriate handler. |
360 if (handled) { | 360 if (handled) { |
361 InstallDefaultHandler(sig); | 361 InstallDefaultHandler(sig); |
362 } else { | 362 } else { |
363 RestoreHandlersLocked(); | 363 RestoreHandlersLocked(); |
364 } | 364 } |
365 | 365 |
366 pthread_mutex_unlock(&g_handler_stack_mutex_); | 366 pthread_mutex_unlock(&g_handler_stack_mutex_); |
367 | 367 |
368 if (info->si_pid || sig == SIGABRT) { | 368 // info->si_code <= 0 iff SI_FROMUSER (SI_FROMKERNEL otherwise). |
| 369 if (info->si_code <= 0 || sig == SIGABRT) { |
369 // This signal was triggered by somebody sending us the signal with kill(). | 370 // This signal was triggered by somebody sending us the signal with kill(). |
370 // In order to retrigger it, we have to queue a new signal by calling | 371 // In order to retrigger it, we have to queue a new signal by calling |
371 // kill() ourselves. The special case (si_pid == 0 && sig == SIGABRT) is | 372 // kill() ourselves. The special case (si_pid == 0 && sig == SIGABRT) is |
372 // due to the kernel sending a SIGABRT from a user request via SysRQ. | 373 // due to the kernel sending a SIGABRT from a user request via SysRQ. |
373 if (tgkill(getpid(), syscall(__NR_gettid), sig) < 0) { | 374 if (tgkill(getpid(), syscall(__NR_gettid), sig) < 0) { |
374 // If we failed to kill ourselves (e.g. because a sandbox disallows us | 375 // If we failed to kill ourselves (e.g. because a sandbox disallows us |
375 // to do so), we instead resort to terminating our process. This will | 376 // to do so), we instead resort to terminating our process. This will |
376 // result in an incorrect exit code. | 377 // result in an incorrect exit code. |
377 _exit(1); | 378 _exit(1); |
378 } | 379 } |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 descriptor.UpdatePath(); | 737 descriptor.UpdatePath(); |
737 if (!google_breakpad::WriteMinidump(descriptor.path(), | 738 if (!google_breakpad::WriteMinidump(descriptor.path(), |
738 child, | 739 child, |
739 child_blamed_thread)) | 740 child_blamed_thread)) |
740 return false; | 741 return false; |
741 | 742 |
742 return callback ? callback(descriptor, callback_context, true) : true; | 743 return callback ? callback(descriptor, callback_context, true) : true; |
743 } | 744 } |
744 | 745 |
745 } // namespace google_breakpad | 746 } // namespace google_breakpad |
OLD | NEW |