Chromium Code Reviews| Index: base/debug/stack_trace_posix.cc |
| diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc |
| index ed1a91889b142f432f67fe34c40d38991992117e..fa68a06f895a6266b1f12c7bffa7df8322426baf 100644 |
| --- a/base/debug/stack_trace_posix.cc |
| +++ b/base/debug/stack_trace_posix.cc |
| @@ -179,7 +179,6 @@ void PrintToStderr(const char* output) { |
| ignore_result(HANDLE_EINTR(write(STDERR_FILENO, output, strlen(output)))); |
| } |
| -#if !defined(OS_IOS) |
| void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) { |
| // NOTE: This code MUST be async-signal safe. |
| // NO malloc or stdio is allowed here. |
| @@ -195,6 +194,8 @@ void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) { |
| char buf[1024] = { 0 }; |
| internal::itoa_r(signal, buf, sizeof(buf), 10, 0); |
| PrintToStderr(buf); |
| +#if !defined(OS_IOS) |
| + // NOTE: on iOS, info and void_context are incorrect. Ignore them. |
|
Mark Mentovai
2014/01/15 19:14:06
If you’ve got a reference (link?) to point to here
|
| if (signal == SIGBUS) { |
| if (info->si_code == BUS_ADRALN) |
| PrintToStderr(" BUS_ADRALN "); |
| @@ -254,6 +255,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) { |
| buf, sizeof(buf), 16, 12); |
| PrintToStderr(buf); |
| } |
| + #endif // !defined(OS_IOS) |
| PrintToStderr("\n"); |
| debug::StackTrace().Print(); |
| @@ -329,7 +331,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) { |
| } |
| PrintToStderr("\n"); |
| #endif |
| -#elif defined(OS_MACOSX) |
| +#elif defined(OS_MACOSX) && !defined(OS_IOS) |
|
Mark Mentovai
2014/01/15 19:14:06
You probably don’t need !defined(OS_IOS) here, bec
|
| // TODO(shess): Port to 64-bit. |
| #if ARCH_CPU_X86_FAMILY && ARCH_CPU_32_BITS |
| ucontext_t* context = reinterpret_cast<ucontext_t*>(void_context); |
| @@ -369,10 +371,9 @@ void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) { |
| context->uc_mcontext->__ss.__gs)); |
| write(STDERR_FILENO, buf, std::min(len, sizeof(buf) - 1)); |
| #endif // ARCH_CPU_32_BITS |
| -#endif // defined(OS_MACOSX) |
| +#endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| _exit(1); |
| } |
| -#endif // !defined(OS_IOS) |
| class PrintBacktraceOutputHandler : public BacktraceOutputHandler { |
| public: |
| @@ -403,7 +404,6 @@ class StreamBacktraceOutputHandler : public BacktraceOutputHandler { |
| DISALLOW_COPY_AND_ASSIGN(StreamBacktraceOutputHandler); |
| }; |
| -#if !defined(OS_IOS) |
| void WarmUpBacktrace() { |
| // Warm up stack trace infrastructure. It turns out that on the first |
| // call glibc initializes some internal data structures using pthread_once, |
| @@ -436,11 +436,9 @@ void WarmUpBacktrace() { |
| // #22 <signal handler called> |
| StackTrace stack_trace; |
| } |
| -#endif // !defined(OS_IOS) |
| } // namespace |
| -#if !defined(OS_IOS) |
| bool EnableInProcessStackDumping() { |
| // When running in an application, our code typically expects SIGPIPE |
| // to be ignored. Therefore, when testing that same code, it should run |
| @@ -469,7 +467,6 @@ bool EnableInProcessStackDumping() { |
| return success; |
| } |
| -#endif // !defined(OS_IOS) |
| StackTrace::StackTrace() { |
| // NOTE: This code MUST be async-signal safe (it's used by in-process |