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__)
12 #include <mach/thread_act.h>
14 #include "RegisterContextMach_i386.h"
17 using namespace lldb_private;
19 RegisterContextMach_i386::RegisterContextMach_i386(Thread &thread,
20 uint32_t concrete_frame_idx)
21 : RegisterContextDarwin_i386(thread, concrete_frame_idx) {}
23 RegisterContextMach_i386::~RegisterContextMach_i386() {}
25 int RegisterContextMach_i386::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) {
26 mach_msg_type_number_t count = GPRWordCount;
27 return ::thread_get_state(tid, flavor, (thread_state_t)&gpr, &count);
30 int RegisterContextMach_i386::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) {
31 mach_msg_type_number_t count = FPUWordCount;
32 return ::thread_get_state(tid, flavor, (thread_state_t)&fpu, &count);
35 int RegisterContextMach_i386::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) {
36 mach_msg_type_number_t count = EXCWordCount;
37 return ::thread_get_state(tid, flavor, (thread_state_t)&exc, &count);
40 int RegisterContextMach_i386::DoWriteGPR(lldb::tid_t tid, int flavor,
42 return ::thread_set_state(
43 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<GPR *>(&gpr)),
47 int RegisterContextMach_i386::DoWriteFPU(lldb::tid_t tid, int flavor,
49 return ::thread_set_state(
50 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<FPU *>(&fpu)),
54 int RegisterContextMach_i386::DoWriteEXC(lldb::tid_t tid, int flavor,
56 return ::thread_set_state(
57 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<EXC *>(&exc)),