]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
Import lua 5.3.4 to contrib
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / Process / Utility / RegisterContextMach_i386.cpp
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
20 using namespace lldb;
21 using namespace lldb_private;
22
23 RegisterContextMach_i386::RegisterContextMach_i386(Thread &thread,
24                                                    uint32_t concrete_frame_idx)
25     : RegisterContextDarwin_i386(thread, concrete_frame_idx) {}
26
27 RegisterContextMach_i386::~RegisterContextMach_i386() {}
28
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);
32 }
33
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);
37 }
38
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);
42 }
43
44 int RegisterContextMach_i386::DoWriteGPR(lldb::tid_t tid, int flavor,
45                                          const GPR &gpr) {
46   return ::thread_set_state(tid, flavor, (thread_state_t)&gpr, GPRWordCount);
47 }
48
49 int RegisterContextMach_i386::DoWriteFPU(lldb::tid_t tid, int flavor,
50                                          const FPU &fpu) {
51   return ::thread_set_state(tid, flavor, (thread_state_t)&fpu, FPUWordCount);
52 }
53
54 int RegisterContextMach_i386::DoWriteEXC(lldb::tid_t tid, int flavor,
55                                          const EXC &exc) {
56   return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount);
57 }
58
59 #endif