| OLD | NEW |
| 1 /* Copyright (c) 2005-2007, Google Inc. | 1 /* Copyright (c) 2005-2007, 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 * time. If the callback ever called ResumeAllProcessThreads(), then | 186 * time. If the callback ever called ResumeAllProcessThreads(), then |
| 187 * we are running a higher risk, though. So, try to avoid calling | 187 * we are running a higher risk, though. So, try to avoid calling |
| 188 * abort() after calling ResumeAllProcessThreads. | 188 * abort() after calling ResumeAllProcessThreads. |
| 189 */ | 189 */ |
| 190 static volatile int *sig_pids, sig_num_threads, sig_proc, sig_marker; | 190 static volatile int *sig_pids, sig_num_threads, sig_proc, sig_marker; |
| 191 | 191 |
| 192 | 192 |
| 193 /* Signal handler to help us recover from dying while we are attached to | 193 /* Signal handler to help us recover from dying while we are attached to |
| 194 * other threads. | 194 * other threads. |
| 195 */ | 195 */ |
| 196 static void SignalHandler(int signum, struct siginfo *si, void *data) { | 196 static void SignalHandler(int signum, siginfo_t *si, void *data) { |
| 197 if (sig_pids != NULL) { | 197 if (sig_pids != NULL) { |
| 198 if (signum == SIGABRT) { | 198 if (signum == SIGABRT) { |
| 199 while (sig_num_threads-- > 0) { | 199 while (sig_num_threads-- > 0) { |
| 200 /* Not sure if sched_yield is really necessary here, but it does not */ | 200 /* Not sure if sched_yield is really necessary here, but it does not */ |
| 201 /* hurt, and it might be necessary for the same reasons that we have */ | 201 /* hurt, and it might be necessary for the same reasons that we have */ |
| 202 /* to do so in sys_ptrace_detach(). */ | 202 /* to do so in sys_ptrace_detach(). */ |
| 203 sys_sched_yield(); | 203 sys_sched_yield(); |
| 204 sys_ptrace(PTRACE_KILL, sig_pids[sig_num_threads], 0, 0); | 204 sys_ptrace(PTRACE_KILL, sig_pids[sig_num_threads], 0, 0); |
| 205 } | 205 } |
| 206 } else if (sig_num_threads > 0) { | 206 } else if (sig_num_threads > 0) { |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 while (num_threads-- > 0) { | 656 while (num_threads-- > 0) { |
| 657 detached_at_least_one |= sys_ptrace_detach(thread_pids[num_threads]) >= 0; | 657 detached_at_least_one |= sys_ptrace_detach(thread_pids[num_threads]) >= 0; |
| 658 } | 658 } |
| 659 return detached_at_least_one; | 659 return detached_at_least_one; |
| 660 } | 660 } |
| 661 | 661 |
| 662 #ifdef __cplusplus | 662 #ifdef __cplusplus |
| 663 } | 663 } |
| 664 #endif | 664 #endif |
| 665 #endif | 665 #endif |
| OLD | NEW |