1 //===-- RegisterContextMach_arm.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 "RegisterContextMach_arm.h"
15 #include <mach/mach_types.h>
16 #include <mach/thread_act.h>
19 // Other libraries and framework includes
23 using namespace lldb_private;
25 RegisterContextMach_arm::RegisterContextMach_arm(Thread &thread,
26 uint32_t concrete_frame_idx)
27 : RegisterContextDarwin_arm(thread, concrete_frame_idx) {}
29 RegisterContextMach_arm::~RegisterContextMach_arm() {}
31 int RegisterContextMach_arm::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) {
32 mach_msg_type_number_t count = GPRWordCount;
33 return ::thread_get_state(tid, flavor, (thread_state_t)&gpr, &count);
36 int RegisterContextMach_arm::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) {
37 mach_msg_type_number_t count = FPUWordCount;
38 return ::thread_get_state(tid, flavor, (thread_state_t)&fpu, &count);
41 int RegisterContextMach_arm::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) {
42 mach_msg_type_number_t count = EXCWordCount;
43 return ::thread_get_state(tid, flavor, (thread_state_t)&exc, &count);
46 int RegisterContextMach_arm::DoReadDBG(lldb::tid_t tid, int flavor, DBG &dbg) {
47 mach_msg_type_number_t count = DBGWordCount;
48 return ::thread_get_state(tid, flavor, (thread_state_t)&dbg, &count);
51 int RegisterContextMach_arm::DoWriteGPR(lldb::tid_t tid, int flavor,
53 return ::thread_set_state(
54 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<GPR *>(&gpr)),
58 int RegisterContextMach_arm::DoWriteFPU(lldb::tid_t tid, int flavor,
60 return ::thread_set_state(
61 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<FPU *>(&fpu)),
65 int RegisterContextMach_arm::DoWriteEXC(lldb::tid_t tid, int flavor,
67 return ::thread_set_state(
68 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<EXC *>(&exc)),
72 int RegisterContextMach_arm::DoWriteDBG(lldb::tid_t tid, int flavor,
74 return ::thread_set_state(
75 tid, flavor, reinterpret_cast<thread_state_t>(const_cast<DBG *>(&dbg)),