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 "vm/globals.h" | 5 #include "vm/globals.h" |
6 #include "vm/instructions.h" | 6 #include "vm/instructions.h" |
7 #include "vm/simulator.h" | 7 #include "vm/simulator.h" |
8 #include "vm/signal_handler.h" | 8 #include "vm/signal_handler.h" |
9 #if defined(HOST_OS_LINUX) | 9 #if defined(HOST_OS_LINUX) |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 | 30 |
31 uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { | 31 uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { |
32 uintptr_t fp = 0; | 32 uintptr_t fp = 0; |
33 | 33 |
34 #if defined(HOST_ARCH_IA32) | 34 #if defined(HOST_ARCH_IA32) |
35 fp = static_cast<uintptr_t>(mcontext.gregs[REG_EBP]); | 35 fp = static_cast<uintptr_t>(mcontext.gregs[REG_EBP]); |
36 #elif defined(HOST_ARCH_X64) | 36 #elif defined(HOST_ARCH_X64) |
37 fp = static_cast<uintptr_t>(mcontext.gregs[REG_RBP]); | 37 fp = static_cast<uintptr_t>(mcontext.gregs[REG_RBP]); |
38 #elif defined(HOST_ARCH_ARM) | 38 #elif defined(HOST_ARCH_ARM) |
39 fp = static_cast<uintptr_t>(mcontext.arm_fp); | 39 // B1.3.3 Program Status Registers (PSRs) |
| 40 if ((mcontext.arm_cpsr & (1 << 5)) != 0) { |
| 41 // Thumb mode. |
| 42 fp = static_cast<uintptr_t>(mcontext.arm_r7); |
| 43 } else { |
| 44 // ARM mode. |
| 45 fp = static_cast<uintptr_t>(mcontext.arm_fp); |
| 46 } |
40 #elif defined(HOST_ARCH_ARM64) | 47 #elif defined(HOST_ARCH_ARM64) |
41 fp = static_cast<uintptr_t>(mcontext.regs[29]); | 48 fp = static_cast<uintptr_t>(mcontext.regs[29]); |
42 #else | 49 #else |
43 #error Unsupported architecture. | 50 #error Unsupported architecture. |
44 #endif // HOST_ARCH_... | 51 #endif // HOST_ARCH_... |
45 | 52 |
46 return fp; | 53 return fp; |
47 } | 54 } |
48 | 55 |
49 | 56 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 sigemptyset(&act.sa_mask); | 118 sigemptyset(&act.sa_mask); |
112 act.sa_flags = 0; | 119 act.sa_flags = 0; |
113 int r = sigaction(SIGPROF, &act, NULL); | 120 int r = sigaction(SIGPROF, &act, NULL); |
114 ASSERT(r == 0); | 121 ASSERT(r == 0); |
115 } | 122 } |
116 | 123 |
117 | 124 |
118 } // namespace dart | 125 } // namespace dart |
119 | 126 |
120 #endif // defined(HOST_OS_LINUX) | 127 #endif // defined(HOST_OS_LINUX) |
OLD | NEW |