| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include <pthread.h> | 31 #include <pthread.h> |
| 32 #include <semaphore.h> | 32 #include <semaphore.h> |
| 33 #include <signal.h> | 33 #include <signal.h> |
| 34 #include <sys/prctl.h> | 34 #include <sys/prctl.h> |
| 35 #include <sys/time.h> | 35 #include <sys/time.h> |
| 36 #include <sys/resource.h> | 36 #include <sys/resource.h> |
| 37 #include <sys/syscall.h> | 37 #include <sys/syscall.h> |
| 38 #include <sys/types.h> | 38 #include <sys/types.h> |
| 39 #include <stdlib.h> | 39 #include <stdlib.h> |
| 40 | 40 |
| 41 #if defined(__GLIBC__) | 41 #if defined(__GLIBC__) && !defined(__UCLIBC__) |
| 42 #include <execinfo.h> | 42 #include <execinfo.h> |
| 43 #include <cxxabi.h> | 43 #include <cxxabi.h> |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 // Ubuntu Dapper requires memory pages to be marked as | 46 // Ubuntu Dapper requires memory pages to be marked as |
| 47 // executable. Otherwise, OS raises an exception when executing code | 47 // executable. Otherwise, OS raises an exception when executing code |
| 48 // in that page. | 48 // in that page. |
| 49 #include <sys/types.h> // mmap & munmap | 49 #include <sys/types.h> // mmap & munmap |
| 50 #include <sys/mman.h> // mmap & munmap | 50 #include <sys/mman.h> // mmap & munmap |
| 51 #include <sys/stat.h> // open | 51 #include <sys/stat.h> // open |
| 52 #include <fcntl.h> // open | 52 #include <fcntl.h> // open |
| 53 #include <unistd.h> // sysconf | 53 #include <unistd.h> // sysconf |
| 54 #if defined(__GLIBC__) && !defined(__UCLIBC__) | |
| 55 #include <execinfo.h> // backtrace, backtrace_symbols | |
| 56 #endif // defined(__GLIBC__) && !defined(__UCLIBC__) | |
| 57 #include <strings.h> // index | 54 #include <strings.h> // index |
| 58 #include <errno.h> | 55 #include <errno.h> |
| 59 #include <stdarg.h> | 56 #include <stdarg.h> |
| 60 | 57 |
| 61 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'. | 58 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'. |
| 62 // Old versions of the C library <signal.h> didn't define the type. | 59 // Old versions of the C library <signal.h> didn't define the type. |
| 63 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) && \ | 60 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) && \ |
| 64 defined(__arm__) && !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT) | 61 defined(__arm__) && !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT) |
| 65 #include <asm/sigcontext.h> | 62 #include <asm/sigcontext.h> |
| 66 #endif | 63 #endif |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 # endif | 423 # endif |
| 427 #elif defined(__mips__) | 424 #elif defined(__mips__) |
| 428 asm("break"); | 425 asm("break"); |
| 429 #else | 426 #else |
| 430 asm("int $3"); | 427 asm("int $3"); |
| 431 #endif | 428 #endif |
| 432 } | 429 } |
| 433 | 430 |
| 434 | 431 |
| 435 void OS::DumpBacktrace() { | 432 void OS::DumpBacktrace() { |
| 436 #if defined(__GLIBC__) | 433 #if defined(__GLIBC__) && !defined(__UCLIBC__) |
| 437 void* trace[100]; | 434 void* trace[100]; |
| 438 int size = backtrace(trace, ARRAY_SIZE(trace)); | 435 int size = backtrace(trace, ARRAY_SIZE(trace)); |
| 439 char** symbols = backtrace_symbols(trace, size); | 436 char** symbols = backtrace_symbols(trace, size); |
| 440 fprintf(stderr, "\n==== C stack trace ===============================\n\n"); | 437 fprintf(stderr, "\n==== C stack trace ===============================\n\n"); |
| 441 if (size == 0) { | 438 if (size == 0) { |
| 442 fprintf(stderr, "(empty)\n"); | 439 fprintf(stderr, "(empty)\n"); |
| 443 } else if (symbols == NULL) { | 440 } else if (symbols == NULL) { |
| 444 fprintf(stderr, "(no symbols)\n"); | 441 fprintf(stderr, "(no symbols)\n"); |
| 445 } else { | 442 } else { |
| 446 for (int i = 1; i < size; ++i) { | 443 for (int i = 1; i < size; ++i) { |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 | 1322 |
| 1326 | 1323 |
| 1327 void Sampler::Stop() { | 1324 void Sampler::Stop() { |
| 1328 ASSERT(IsActive()); | 1325 ASSERT(IsActive()); |
| 1329 SignalSender::RemoveActiveSampler(this); | 1326 SignalSender::RemoveActiveSampler(this); |
| 1330 SetActive(false); | 1327 SetActive(false); |
| 1331 } | 1328 } |
| 1332 | 1329 |
| 1333 | 1330 |
| 1334 } } // namespace v8::internal | 1331 } } // namespace v8::internal |
| OLD | NEW |