1//===-- RegisterContextMach_i386.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_i386.h" 19 20using namespace lldb; 21using namespace lldb_private; 22 23 24RegisterContextMach_i386::RegisterContextMach_i386(Thread &thread, uint32_t concrete_frame_idx) : 25 RegisterContextDarwin_i386 (thread, concrete_frame_idx) 26{ 27} 28 29RegisterContextMach_i386::~RegisterContextMach_i386() 30{ 31} 32 33int 34RegisterContextMach_i386::DoReadGPR (lldb::tid_t tid, int flavor, GPR &gpr) 35{ 36 mach_msg_type_number_t count = GPRWordCount; 37 return ::thread_get_state(tid, flavor, (thread_state_t)&gpr, &count); 38} 39 40int 41RegisterContextMach_i386::DoReadFPU (lldb::tid_t tid, int flavor, FPU &fpu) 42{ 43 mach_msg_type_number_t count = FPUWordCount; 44 return ::thread_get_state(tid, flavor, (thread_state_t)&fpu, &count); 45} 46 47int 48RegisterContextMach_i386::DoReadEXC (lldb::tid_t tid, int flavor, EXC &exc) 49{ 50 mach_msg_type_number_t count = EXCWordCount; 51 return ::thread_get_state(tid, flavor, (thread_state_t)&exc, &count); 52} 53 54int 55RegisterContextMach_i386::DoWriteGPR (lldb::tid_t tid, int flavor, const GPR &gpr) 56{ 57 return ::thread_set_state(tid, flavor, (thread_state_t)&gpr, GPRWordCount); 58} 59 60int 61RegisterContextMach_i386::DoWriteFPU (lldb::tid_t tid, int flavor, const FPU &fpu) 62{ 63 return ::thread_set_state(tid, flavor, (thread_state_t)&fpu, FPUWordCount); 64} 65 66int 67RegisterContextMach_i386::DoWriteEXC (lldb::tid_t tid, int flavor, const EXC &exc) 68{ 69 return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount); 70} 71 72#endif 73