aboutsummaryrefslogtreecommitdiff
path: root/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
blob: a4cf0771019466987a9f97098730e57a053fbae3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//===-- RegisterContextMach_arm.cpp -----------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#if defined(__APPLE__)

#include "RegisterContextMach_arm.h"

// C Includes
#include <mach/mach_types.h>
#include <mach/thread_act.h>

// C++ Includes
// Other libraries and framework includes
// Project includes

using namespace lldb;
using namespace lldb_private;

RegisterContextMach_arm::RegisterContextMach_arm(Thread &thread,
                                                 uint32_t concrete_frame_idx)
    : RegisterContextDarwin_arm(thread, concrete_frame_idx) {}

RegisterContextMach_arm::~RegisterContextMach_arm() {}

int RegisterContextMach_arm::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) {
  mach_msg_type_number_t count = GPRWordCount;
  return ::thread_get_state(tid, flavor, (thread_state_t)&gpr, &count);
}

int RegisterContextMach_arm::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) {
  mach_msg_type_number_t count = FPUWordCount;
  return ::thread_get_state(tid, flavor, (thread_state_t)&fpu, &count);
}

int RegisterContextMach_arm::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) {
  mach_msg_type_number_t count = EXCWordCount;
  return ::thread_get_state(tid, flavor, (thread_state_t)&exc, &count);
}

int RegisterContextMach_arm::DoReadDBG(lldb::tid_t tid, int flavor, DBG &dbg) {
  mach_msg_type_number_t count = DBGWordCount;
  return ::thread_get_state(tid, flavor, (thread_state_t)&dbg, &count);
}

int RegisterContextMach_arm::DoWriteGPR(lldb::tid_t tid, int flavor,
                                        const GPR &gpr) {
  return ::thread_set_state(tid, flavor, (thread_state_t)&gpr, GPRWordCount);
}

int RegisterContextMach_arm::DoWriteFPU(lldb::tid_t tid, int flavor,
                                        const FPU &fpu) {
  return ::thread_set_state(tid, flavor, (thread_state_t)&fpu, FPUWordCount);
}

int RegisterContextMach_arm::DoWriteEXC(lldb::tid_t tid, int flavor,
                                        const EXC &exc) {
  return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount);
}

int RegisterContextMach_arm::DoWriteDBG(lldb::tid_t tid, int flavor,
                                        const DBG &dbg) {
  return ::thread_set_state(tid, flavor, (thread_state_t)&dbg, DBGWordCount);
}

#endif