Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <dirent.h> | 5 #include <dirent.h> |
| 6 #include <errno.h> | 6 #include <errno.h> |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
| 11 #include <sys/time.h> | 11 #include <sys/time.h> |
| 12 #include <sys/types.h> | 12 #include <sys/types.h> |
| 13 #include <sys/wait.h> | 13 #include <sys/wait.h> |
| 14 #include <unistd.h> | 14 #include <unistd.h> |
| 15 | 15 |
| 16 #include <limits> | 16 #include <limits> |
| 17 #include <set> | 17 #include <set> |
| 18 | 18 |
| 19 #include "base/command_line.h" | 19 #include "base/command_line.h" |
| 20 #include "base/compiler_specific.h" | 20 #include "base/compiler_specific.h" |
| 21 #include "base/debug/debugger.h" | |
| 21 #include "base/debug/stack_trace.h" | 22 #include "base/debug/stack_trace.h" |
| 22 #include "base/dir_reader_posix.h" | 23 #include "base/dir_reader_posix.h" |
| 23 #include "base/eintr_wrapper.h" | 24 #include "base/eintr_wrapper.h" |
| 24 #include "base/file_util.h" | 25 #include "base/file_util.h" |
| 25 #include "base/logging.h" | 26 #include "base/logging.h" |
| 26 #include "base/memory/scoped_ptr.h" | 27 #include "base/memory/scoped_ptr.h" |
| 27 #include "base/process_util.h" | 28 #include "base/process_util.h" |
| 28 #include "base/stringprintf.h" | 29 #include "base/stringprintf.h" |
| 29 #include "base/synchronization/waitable_event.h" | 30 #include "base/synchronization/waitable_event.h" |
| 30 #include "base/threading/platform_thread.h" | 31 #include "base/threading/platform_thread.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 } | 99 } |
| 99 } | 100 } |
| 100 | 101 |
| 101 if (success) | 102 if (success) |
| 102 *success = (ret_pid != -1); | 103 *success = (ret_pid != -1); |
| 103 | 104 |
| 104 return status; | 105 return status; |
| 105 } | 106 } |
| 106 | 107 |
| 107 void StackDumpSignalHandler(int signal, siginfo_t* info, ucontext_t* context) { | 108 void StackDumpSignalHandler(int signal, siginfo_t* info, ucontext_t* context) { |
| 109 if (debug::BeingDebugged()) | |
|
Evan Martin
2011/06/10 16:39:05
Does this work? I thought we didn't implement thi
Sheridan Rawlins
2011/06/10 23:02:58
It is implemented, and worked for me.
On 2011/06/
| |
| 110 debug::BreakDebugger(); | |
| 111 | |
| 108 LOG(ERROR) << "Received signal " << signal; | 112 LOG(ERROR) << "Received signal " << signal; |
| 109 debug::StackTrace().PrintBacktrace(); | 113 debug::StackTrace().PrintBacktrace(); |
| 110 | 114 |
| 111 // TODO(shess): Port to Linux. | 115 // TODO(shess): Port to Linux. |
| 112 #if defined(OS_MACOSX) | 116 #if defined(OS_MACOSX) |
| 113 // TODO(shess): Port to 64-bit. | 117 // TODO(shess): Port to 64-bit. |
| 114 #if ARCH_CPU_32_BITS | 118 #if ARCH_CPU_32_BITS |
| 115 char buf[1024]; | 119 char buf[1024]; |
| 116 size_t len; | 120 size_t len; |
| 117 | 121 |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 993 const ProcessFilter* filter) { | 997 const ProcessFilter* filter) { |
| 994 bool exited_cleanly = | 998 bool exited_cleanly = |
| 995 WaitForProcessesToExit(executable_name, wait_milliseconds, | 999 WaitForProcessesToExit(executable_name, wait_milliseconds, |
| 996 filter); | 1000 filter); |
| 997 if (!exited_cleanly) | 1001 if (!exited_cleanly) |
| 998 KillProcesses(executable_name, exit_code, filter); | 1002 KillProcesses(executable_name, exit_code, filter); |
| 999 return exited_cleanly; | 1003 return exited_cleanly; |
| 1000 } | 1004 } |
| 1001 | 1005 |
| 1002 } // namespace base | 1006 } // namespace base |
| OLD | NEW |