1 //===-- RegisterContextMach_x86_64.cpp --------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #if defined(__APPLE__)
12 #include <mach/thread_act.h>
14 #include "RegisterContextMach_x86_64.h"
17 using namespace lldb_private;
19 RegisterContextMach_x86_64::RegisterContextMach_x86_64(
20 Thread &thread, uint32_t concrete_frame_idx)
21 : RegisterContextDarwin_x86_64(thread, concrete_frame_idx) {}
23 RegisterContextMach_x86_64::~RegisterContextMach_x86_64() {}
25 int RegisterContextMach_x86_64::DoReadGPR(lldb::tid_t tid, int flavor,
27 mach_msg_type_number_t count = GPRWordCount;
28 return ::thread_get_state(tid, flavor, (thread_state_t)&gpr, &count);
31 int RegisterContextMach_x86_64::DoReadFPU(lldb::tid_t tid, int flavor,
33 mach_msg_type_number_t count = FPUWordCount;
34 return ::thread_get_state(tid, flavor, (thread_state_t)&fpu, &count);
37 int RegisterContextMach_x86_64::DoReadEXC(lldb::tid_t tid, int flavor,
39 mach_msg_type_number_t count = EXCWordCount;
40 return ::thread_get_state(tid, flavor, (thread_state_t)&exc, &count);
43 int RegisterContextMach_x86_64::DoWriteGPR(lldb::tid_t tid, int flavor,
45 return ::thread_set_state(
46 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<GPR *>(&gpr)),
50 int RegisterContextMach_x86_64::DoWriteFPU(lldb::tid_t tid, int flavor,
52 return ::thread_set_state(
53 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<FPU *>(&fpu)),
57 int RegisterContextMach_x86_64::DoWriteEXC(lldb::tid_t tid, int flavor,
59 return ::thread_set_state(
60 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<EXC *>(&exc)),