Chromium Code Reviews| Index: third_party/tcmalloc/chromium/src/getpc.h |
| diff --git a/third_party/tcmalloc/chromium/src/getpc.h b/third_party/tcmalloc/chromium/src/getpc.h |
| index 9fb2e162beb22621406918ec017f2dd3bc2ea073..f102f41862315e4a44455d771224f8e82a1fbd25 100644 |
| --- a/third_party/tcmalloc/chromium/src/getpc.h |
| +++ b/third_party/tcmalloc/chromium/src/getpc.h |
| @@ -62,6 +62,8 @@ |
| #elif defined(HAVE_CYGWIN_SIGNAL_H) |
| #include <cygwin/signal.h> |
| typedef ucontext ucontext_t; |
| +#elif defined(__ANDROID__) |
| +#include <unwind.h> |
| #endif |
| @@ -109,7 +111,8 @@ struct CallUnrollInfo { |
| // then, is to do the magic call-unrolling for systems that support it. |
| // -- Special case 1: linux x86, for which we have CallUnrollInfo |
| -#if defined(__linux) && defined(__i386) && defined(__GNUC__) |
| +#if defined(__linux) && defined(__i386) && defined(__GNUC__) && \ |
| + !defined(__ANDROID__) |
| static const CallUnrollInfo callunrollinfo[] = { |
| // Entry to a function: push %ebp; mov %esp,%ebp |
| // Top-of-stack contains the caller IP. |
| @@ -171,12 +174,22 @@ inline void* GetPC(const struct ucontext_t& signal_ucontext) { |
| RAW_LOG(ERROR, "GetPC is not yet implemented on Windows\n"); |
| return NULL; |
| } |
| +#elif defined(__ANDROID__) |
|
Dai Mikurube (NOT FULLTIME)
2013/05/08 14:53:25
nit: no empty line? (not mandatory)
bulach
2013/05/08 16:09:10
Done.
|
| +typedef struct _Unwind_Context ucontext_t; |
| + |
| +inline void* GetPC(const ucontext_t& signal_ucontext) { |
| + // Bionic doesn't export ucontext, see |
| + // https://code.google.com/p/android/issues/detail?id=34784. |
| + return reinterpret_cast<void*>(_Unwind_GetIP( |
| + const_cast<ucontext_t*>(&signal_ucontext))); |
| +} |
| +#else |
|
Dai Mikurube (NOT FULLTIME)
2013/05/08 14:53:25
Why did you move this #else?
bulach
2013/05/08 16:09:10
no reason :) moved back.
|
| +// |
| // Normal cases. If this doesn't compile, it's probably because |
| // PC_FROM_UCONTEXT is the empty string. You need to figure out |
| // the right value for your system, and add it to the list in |
| // configure.ac (or set it manually in your config.h). |
| -#else |
| inline void* GetPC(const ucontext_t& signal_ucontext) { |
| return (void*)signal_ucontext.PC_FROM_UCONTEXT; // defined in config.h |
| } |