| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/address_sanitizer.h" | 5 #include "platform/address_sanitizer.h" |
| 6 #include "platform/memory_sanitizer.h" | 6 #include "platform/memory_sanitizer.h" |
| 7 #include "platform/utils.h" | 7 #include "platform/utils.h" |
| 8 | 8 |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/atomic.h" | 10 #include "vm/atomic.h" |
| (...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 | 1069 |
| 1070 | 1070 |
| 1071 void Profiler::DumpStackTrace(void* context) { | 1071 void Profiler::DumpStackTrace(void* context) { |
| 1072 #if defined(HOST_OS_LINUX) || defined(HOST_OS_MACOS) | 1072 #if defined(HOST_OS_LINUX) || defined(HOST_OS_MACOS) |
| 1073 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 1073 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
| 1074 mcontext_t mcontext = ucontext->uc_mcontext; | 1074 mcontext_t mcontext = ucontext->uc_mcontext; |
| 1075 uword pc = SignalHandler::GetProgramCounter(mcontext); | 1075 uword pc = SignalHandler::GetProgramCounter(mcontext); |
| 1076 uword fp = SignalHandler::GetFramePointer(mcontext); | 1076 uword fp = SignalHandler::GetFramePointer(mcontext); |
| 1077 uword sp = SignalHandler::GetCStackPointer(mcontext); | 1077 uword sp = SignalHandler::GetCStackPointer(mcontext); |
| 1078 DumpStackTrace(sp, fp, pc, true /* for_crash */); | 1078 DumpStackTrace(sp, fp, pc, true /* for_crash */); |
| 1079 #elif defined(HOST_OS_WINDOWS) |
| 1080 CONTEXT* ctx = reinterpret_cast<CONTEXT*>(context); |
| 1081 #if defined(HOST_ARCH_IA32) |
| 1082 uword pc = static_cast<uword>(ctx->Eip); |
| 1083 uword fp = static_cast<uword>(ctx->Ebp); |
| 1084 uword sp = static_cast<uword>(ctx->Esp); |
| 1085 #elif defined(HOST_ARCH_X64) |
| 1086 uword pc = static_cast<uword>(ctx->Rip); |
| 1087 uword fp = static_cast<uword>(ctx->Rbp); |
| 1088 uword sp = static_cast<uword>(ctx->Rsp); |
| 1089 #else |
| 1090 #error Unsupported architecture. |
| 1091 #endif |
| 1092 DumpStackTrace(sp, fp, pc, true /* for_crash */); |
| 1079 #else | 1093 #else |
| 1080 // TODO(fschneider): Add support for more platforms. | 1094 // TODO(fschneider): Add support for more platforms. |
| 1081 // Do nothing on unsupported platforms. | 1095 // Do nothing on unsupported platforms. |
| 1082 #endif | 1096 #endif |
| 1083 } | 1097 } |
| 1084 | 1098 |
| 1085 | 1099 |
| 1086 void Profiler::DumpStackTrace(bool for_crash) { | 1100 void Profiler::DumpStackTrace(bool for_crash) { |
| 1087 uintptr_t sp = Thread::GetCurrentStackPointer(); | 1101 uintptr_t sp = Thread::GetCurrentStackPointer(); |
| 1088 uintptr_t fp = 0; | 1102 uintptr_t fp = 0; |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 | 1735 |
| 1722 | 1736 |
| 1723 ProcessedSampleBuffer::ProcessedSampleBuffer() | 1737 ProcessedSampleBuffer::ProcessedSampleBuffer() |
| 1724 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { | 1738 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { |
| 1725 ASSERT(code_lookup_table_ != NULL); | 1739 ASSERT(code_lookup_table_ != NULL); |
| 1726 } | 1740 } |
| 1727 | 1741 |
| 1728 #endif // !PRODUCT | 1742 #endif // !PRODUCT |
| 1729 | 1743 |
| 1730 } // namespace dart | 1744 } // namespace dart |
| OLD | NEW |