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( 50 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<GPR *>(&gpr)), 51 GPRWordCount); 52 } 53 54 int RegisterContextMach_x86_64::DoWriteFPU(lldb::tid_t tid, int flavor, 55 const FPU &fpu) { 56 return ::thread_set_state( 57 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<FPU *>(&fpu)), 58 FPUWordCount); 59 } 60 61 int RegisterContextMach_x86_64::DoWriteEXC(lldb::tid_t tid, int flavor, 62 const EXC &exc) { 63 return ::thread_set_state( 64 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<EXC *>(&exc)), 65 EXCWordCount); 66 } 67 68 #endif 69