Reviewers: Kasper Lund,

Description:
Fix profiling on Android.

Please review this at http://codereview.chromium.org/62102

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/platform-linux.cc


Index: src/platform-linux.cc
===================================================================
--- src/platform-linux.cc       (revision 1677)
+++ src/platform-linux.cc       (working copy)
@@ -552,9 +552,36 @@

  static Sampler* active_sampler_ = NULL;

+
+#ifndef __GLIBC__
+// Android runs a fairly new Linux kernel, so signals are a there,
+// but the C library doesn't have the structs defined.
+
+struct sigcontext {
+  unsigned long trap_no;
+  unsigned long error_code;
+  unsigned long oldmask;
+  unsigned long gregs[16];
+  unsigned long arm_cpsr;
+  unsigned long fault_address;
+};
+typedef unsigned long __sigset_t;
+typedef struct sigcontext mcontext_t;
+typedef struct ucontext {
+   unsigned long uc_flags;
+   struct ucontext *uc_link;
+   stack_t uc_stack;
+   mcontext_t uc_mcontext;
+  __sigset_t uc_sigmask;
+} ucontext_t;
+#define R15 15
+#define R13 13
+#define R11 11
+
+#endif
+
+
  static void ProfilerSignalHandler(int signal, siginfo_t* info, void*  
context) {
-  // Ucontext is a glibc extension - no profiling on Android at the moment.
-#ifdef __GLIBC__
    USE(info);
    if (signal != SIGPROF) return;
    if (active_sampler_ == NULL) return;
@@ -581,7 +608,6 @@
    sample.state = Logger::state();

    active_sampler_->Tick(&sample);
-#endif
  }





--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to