Chromium Code Reviews| Index: base/process_util_posix.cc |
| diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc |
| index 6d41fe6cd66c034a26ce80848af7bdc76051eabd..a40d812607e6ea0eedf2d12addb2c01a6ebb5c41 100644 |
| --- a/base/process_util_posix.cc |
| +++ b/base/process_util_posix.cc |
| @@ -141,16 +141,23 @@ void StackDumpSignalHandler(int signal, siginfo_t* info, ucontext_t* context) { |
| if (debug::BeingDebugged()) |
| debug::BreakDebugger(); |
| - DLOG(ERROR) << "Received signal " << signal; |
| - debug::StackTrace().PrintBacktrace(); |
| + char buf[1024]; |
| + size_t len; |
| + |
| + // NOTE: Even |snprintf()| is not on the approved list for signal |
| + // handlers, but buffered I/O is definitely not on the list due to |
| + // potential for |malloc()|. |
| + len = static_cast<size_t>( |
| + snprintf(buf, sizeof(buf), "Received signal %d\n", signal)); |
| + ignore_result(write(STDERR_FILENO, buf, std::min(len, sizeof(buf) - 1))); |
| + |
| + // TODO(phajdan.jr): Re-enable backtrace printing after fixing the hang. |
| + // debug::StackTrace().PrintBacktrace(); |
| // TODO(shess): Port to Linux. |
| #if defined(OS_MACOSX) |
|
Scott Hess - ex-Googler
2012/10/30 23:47:59
I would prefer to have the PrintBacktrace() enable
|
| // TODO(shess): Port to 64-bit. |
| #if ARCH_CPU_32_BITS |
| - char buf[1024]; |
| - size_t len; |
| - |
| // NOTE: Even |snprintf()| is not on the approved list for signal |
| // handlers, but buffered I/O is definitely not on the list due to |
| // potential for |malloc()|. |