1 //===-- RegisterContextMach_i386.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__)
13 #include <mach/thread_act.h>
16 // Other libraries and framework includes
18 #include "RegisterContextMach_i386.h"
21 using namespace lldb_private;
23 RegisterContextMach_i386::RegisterContextMach_i386(Thread &thread,
24 uint32_t concrete_frame_idx)
25 : RegisterContextDarwin_i386(thread, concrete_frame_idx) {}
27 RegisterContextMach_i386::~RegisterContextMach_i386() {}
29 int RegisterContextMach_i386::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) {
30 mach_msg_type_number_t count = GPRWordCount;
31 return ::thread_get_state(tid, flavor, (thread_state_t)&gpr, &count);
34 int RegisterContextMach_i386::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) {
35 mach_msg_type_number_t count = FPUWordCount;
36 return ::thread_get_state(tid, flavor, (thread_state_t)&fpu, &count);
39 int RegisterContextMach_i386::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) {
40 mach_msg_type_number_t count = EXCWordCount;
41 return ::thread_get_state(tid, flavor, (thread_state_t)&exc, &count);
44 int RegisterContextMach_i386::DoWriteGPR(lldb::tid_t tid, int flavor,
46 return ::thread_set_state(
47 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<GPR *>(&gpr)),
51 int RegisterContextMach_i386::DoWriteFPU(lldb::tid_t tid, int flavor,
53 return ::thread_set_state(
54 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<FPU *>(&fpu)),
58 int RegisterContextMach_i386::DoWriteEXC(lldb::tid_t tid, int flavor,
60 return ::thread_set_state(
61 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<EXC *>(&exc)),