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..d22cfdbcdff934d930e2ef04970ef72cae02721a 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 |
@@ -139,7 +141,7 @@ inline void* GetPC(const ucontext_t& signal_ucontext) { |
if ((eip & 0xffff0000) != 0 && (~eip & 0xffff0000) != 0 && |
(esp & 0xffff0000) != 0) { |
char* eip_char = reinterpret_cast<char*>(eip); |
- for (int i = 0; i < sizeof(callunrollinfo)/sizeof(*callunrollinfo); ++i) { |
+ for (int i = 0; i < sizeof(CallUnrollInfo)/sizeof(*callunrollinfo); ++i) { |
Dai Mikurube (NOT FULLTIME)
2013/05/03 08:53:00
It's necessary? (Since tcmalloc is a third_party
bulach
2013/05/07 14:55:51
Done.
|
if (!memcmp(eip_char + callunrollinfo[i].pc_offset, |
callunrollinfo[i].ins, callunrollinfo[i].ins_size)) { |
// We have a match. |
@@ -171,12 +173,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__) |
+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 |
+// |
// 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 |
} |