| 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/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "vm/thread_interrupter.h" | 8 #include "vm/thread_interrupter.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 DECLARE_FLAG(bool, thread_interrupter); | 12 DECLARE_FLAG(bool, thread_interrupter); |
| 13 DECLARE_FLAG(bool, trace_thread_interrupter); | 13 DECLARE_FLAG(bool, trace_thread_interrupter); |
| 14 | 14 |
| 15 #define kThreadError -1 | 15 #define kThreadError -1 |
| 16 | 16 |
| 17 class ThreadInterrupterWin : public AllStatic { | 17 class ThreadInterrupterWin : public AllStatic { |
| 18 public: | 18 public: |
| 19 static bool GrabRegisters(HANDLE handle, InterruptedThreadState* state) { | 19 static bool GrabRegisters(HANDLE handle, InterruptedThreadState* state) { |
| 20 CONTEXT context; | 20 CONTEXT context; |
| 21 memset(&context, 0, sizeof(context)); | 21 memset(&context, 0, sizeof(context)); |
| 22 context.ContextFlags = CONTEXT_CONTROL; | 22 context.ContextFlags = CONTEXT_CONTROL; |
| 23 if (GetThreadContext(handle, &context) != 0) { | 23 if (GetThreadContext(handle, &context) != 0) { |
| 24 #if defined(TARGET_ARCH_IA32) | 24 #if defined(TARGET_ARCH_IA32) |
| 25 state->pc = static_cast<uintptr_t>(context.Eip); | 25 state->pc = static_cast<uintptr_t>(context.Eip); |
| 26 state->fp = static_cast<uintptr_t>(context.Ebp); | 26 state->fp = static_cast<uintptr_t>(context.Ebp); |
| 27 state->sp = static_cast<uintptr_t>(context.Esp); | 27 state->sp = static_cast<uintptr_t>(context.Esp); |
| 28 #elif defined(TARGET_ARCH_X64) | 28 #elif defined(TARGET_ARCH_X64) |
| 29 state->pc = reinterpret_cast<uintptr_t>(context.Rip); | 29 state->pc = static_cast<uintptr_t>(context.Rip); |
| 30 state->fp = reinterpret_cast<uintptr_t>(context.Rbp); | 30 state->fp = static_cast<uintptr_t>(context.Rbp); |
| 31 state->sp = reinterpret_cast<uintptr_t>(context.Rsp); | 31 state->sp = static_cast<uintptr_t>(context.Rsp); |
| 32 #else | 32 #else |
| 33 UNIMPLEMENTED(); | 33 UNIMPLEMENTED(); |
| 34 #endif | 34 #endif |
| 35 return true; | 35 return true; |
| 36 } | 36 } |
| 37 return false; | 37 return false; |
| 38 } | 38 } |
| 39 | 39 |
| 40 | 40 |
| 41 static void Interrupt(InterruptableThreadState* state) { | 41 static void Interrupt(InterruptableThreadState* state) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 void ThreadInterrupter::InstallSignalHandler() { | 96 void ThreadInterrupter::InstallSignalHandler() { |
| 97 // Nothing to do on Windows. | 97 // Nothing to do on Windows. |
| 98 } | 98 } |
| 99 | 99 |
| 100 | 100 |
| 101 } // namespace dart | 101 } // namespace dart |
| 102 | 102 |
| 103 #endif // defined(TARGET_OS_WINDOWS) | 103 #endif // defined(TARGET_OS_WINDOWS) |
| 104 | 104 |
| OLD | NEW |