Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: runtime/vm/signal_handler_macos.cc

Issue 1156053006: - Determine whether the simulator is being used in globals.h (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/signal_handler_linux.cc ('k') | runtime/vm/simulator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/simulator.h" 6 #include "vm/simulator.h"
7 #include "vm/signal_handler.h" 7 #include "vm/signal_handler.h"
8 #if defined(TARGET_OS_MACOS) 8 #if defined(TARGET_OS_MACOS)
9 9
10 namespace dart { 10 namespace dart {
11 11
12 uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) { 12 uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) {
13 uintptr_t pc = 0; 13 uintptr_t pc = 0;
14 14
15 #if defined(TARGET_ARCH_IA32) 15 #if defined(HOST_ARCH_IA32)
16 pc = static_cast<uintptr_t>(mcontext->__ss.__eip); 16 pc = static_cast<uintptr_t>(mcontext->__ss.__eip);
17 #elif defined(TARGET_ARCH_X64) 17 #elif defined(HOST_ARCH_X64)
18 pc = static_cast<uintptr_t>(mcontext->__ss.__rip); 18 pc = static_cast<uintptr_t>(mcontext->__ss.__rip);
19 #elif defined(TARGET_ARCH_MIPS) && defined(USING_SIMULATOR) 19 #elif defined(HOST_ARCH_ARM)
20 pc = static_cast<uintptr_t>(mcontext->__ss.__eip); 20 pc = static_cast<uintptr_t>(mcontext->__ss.__pc);
21 #elif defined(TARGET_ARCH_ARM) && defined(USING_SIMULATOR) 21 #elif defined(HOST_ARCH_ARM64)
22 pc = static_cast<uintptr_t>(mcontext->__ss.__eip); 22 pc = static_cast<uintptr_t>(mcontext->__ss.__pc);
23 #elif defined(TARGET_ARCH_ARM64) && defined(USING_SIMULATOR)
24 pc = static_cast<uintptr_t>(mcontext->__ss.__rip);
25 #else 23 #else
26 UNIMPLEMENTED(); 24 #error Unsuported architecture.
27 #endif // TARGET_ARCH_... 25 #endif // HOST_ARCH_...
28 26
29 return pc; 27 return pc;
30 } 28 }
31 29
32 30
33 uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { 31 uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) {
34 uintptr_t fp = 0; 32 uintptr_t fp = 0;
35 33
36 #if defined(TARGET_ARCH_IA32) 34 #if defined(HOST_ARCH_IA32)
37 fp = static_cast<uintptr_t>(mcontext->__ss.__ebp); 35 fp = static_cast<uintptr_t>(mcontext->__ss.__ebp);
38 #elif defined(TARGET_ARCH_X64) 36 #elif defined(HOST_ARCH_X64)
39 fp = static_cast<uintptr_t>(mcontext->__ss.__rbp); 37 fp = static_cast<uintptr_t>(mcontext->__ss.__rbp);
40 #elif defined(TARGET_ARCH_MIPS) && defined(USING_SIMULATOR) 38 #elif defined(HOST_ARCH_ARM)
41 fp = static_cast<uintptr_t>(mcontext->__ss.__ebp); 39 fp = static_cast<uintptr_t>(mcontext->__ss.__r[11]);
42 #elif defined(TARGET_ARCH_ARM) && defined(USING_SIMULATOR) 40 #elif defined(HOST_ARCH_ARM64)
43 fp = static_cast<uintptr_t>(mcontext->__ss.__ebp); 41 fp = static_cast<uintptr_t>(mcontext->__ss.__fp);
44 #elif defined(TARGET_ARCH_ARM64) && defined(USING_SIMULATOR)
45 fp = static_cast<uintptr_t>(mcontext->__ss.__rbp);
46 #else 42 #else
47 UNIMPLEMENTED(); 43 #error Unsuported architecture.
48 #endif // TARGET_ARCH_... 44 #endif // HOST_ARCH_...
49 45
50 return fp; 46 return fp;
51 } 47 }
52 48
53 49
54 uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { 50 uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) {
55 uintptr_t sp = 0; 51 uintptr_t sp = 0;
56 52
57 #if defined(TARGET_ARCH_IA32) 53 #if defined(HOST_ARCH_IA32)
58 sp = static_cast<uintptr_t>(mcontext->__ss.__esp); 54 sp = static_cast<uintptr_t>(mcontext->__ss.__esp);
59 #elif defined(TARGET_ARCH_X64) 55 #elif defined(HOST_ARCH_X64)
60 sp = static_cast<uintptr_t>(mcontext->__ss.__rsp); 56 sp = static_cast<uintptr_t>(mcontext->__ss.__rsp);
61 #elif defined(TARGET_ARCH_MIPS) && defined(USING_SIMULATOR) 57 #elif defined(HOST_ARCH_ARM)
62 sp = static_cast<uintptr_t>(mcontext->__ss.__esp); 58 sp = static_cast<uintptr_t>(mcontext->__ss.__sp);
63 #elif defined(TARGET_ARCH_ARM) && defined(USING_SIMULATOR) 59 #elif defined(HOST_ARCH_ARM64)
64 sp = static_cast<uintptr_t>(mcontext->__ss.__esp); 60 sp = static_cast<uintptr_t>(mcontext->__ss.__sp);
65 #elif defined(TARGET_ARCH_ARM64) && defined(USING_SIMULATOR)
66 sp = static_cast<uintptr_t>(mcontext->__ss.__rsp);
67 #else 61 #else
68 UNIMPLEMENTED(); 62 UNIMPLEMENTED();
69 #endif // TARGET_ARCH_... 63 #endif // HOST_ARCH_...
70 64
71 return sp; 65 return sp;
72 } 66 }
73 67
74 68
75 uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { 69 uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) {
76 return GetCStackPointer(mcontext); 70 return GetCStackPointer(mcontext);
77 } 71 }
78 72
79 73
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 sigemptyset(&act.sa_mask); 117 sigemptyset(&act.sa_mask);
124 act.sa_flags = 0; 118 act.sa_flags = 0;
125 int r = sigaction(SIGPROF, &act, NULL); 119 int r = sigaction(SIGPROF, &act, NULL);
126 ASSERT(r == 0); 120 ASSERT(r == 0);
127 } 121 }
128 122
129 123
130 } // namespace dart 124 } // namespace dart
131 125
132 #endif // defined(TARGET_OS_MACOS) 126 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/vm/signal_handler_linux.cc ('k') | runtime/vm/simulator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698