1 //===-- RegisterContextMach_x86_64.cpp --------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #if defined(__APPLE__) 11 12 // C Includes 13 #include <mach/thread_act.h> 14 15 // C++ Includes 16 // Other libraries and framework includes 17 // Project includes 18 #include "RegisterContextMach_x86_64.h" 19 20 using namespace lldb; 21 using namespace lldb_private; 22 23 RegisterContextMach_x86_64::RegisterContextMach_x86_64( 24 Thread &thread, uint32_t concrete_frame_idx) 25 : RegisterContextDarwin_x86_64(thread, concrete_frame_idx) {} 26 27 RegisterContextMach_x86_64::~RegisterContextMach_x86_64() {} 28 29 int RegisterContextMach_x86_64::DoReadGPR(lldb::tid_t tid, int flavor, 30 GPR &gpr) { 31 mach_msg_type_number_t count = GPRWordCount; 32 return ::thread_get_state(tid, flavor, (thread_state_t)&gpr, &count); 33 } 34 35 int RegisterContextMach_x86_64::DoReadFPU(lldb::tid_t tid, int flavor, 36 FPU &fpu) { 37 mach_msg_type_number_t count = FPUWordCount; 38 return ::thread_get_state(tid, flavor, (thread_state_t)&fpu, &count); 39 } 40 41 int RegisterContextMach_x86_64::DoReadEXC(lldb::tid_t tid, int flavor, 42 EXC &exc) { 43 mach_msg_type_number_t count = EXCWordCount; 44 return ::thread_get_state(tid, flavor, (thread_state_t)&exc, &count); 45 } 46 47 int RegisterContextMach_x86_64::DoWriteGPR(lldb::tid_t tid, int flavor, 48 const GPR &gpr) { 49 return ::thread_set_state(tid, flavor, (thread_state_t)&gpr, GPRWordCount); 50 } 51 52 int RegisterContextMach_x86_64::DoWriteFPU(lldb::tid_t tid, int flavor, 53 const FPU &fpu) { 54 return ::thread_set_state(tid, flavor, (thread_state_t)&fpu, FPUWordCount); 55 } 56 57 int RegisterContextMach_x86_64::DoWriteEXC(lldb::tid_t tid, int flavor, 58 const EXC &exc) { 59 return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount); 60 } 61 62 #endif 63