]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/llvm/tools/lldb/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.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
24 RegisterContextMach_i386::RegisterContextMach_i386(Thread &thread, uint32_t concrete_frame_idx) :
25     RegisterContextDarwin_i386 (thread, concrete_frame_idx)
26 {
27 }
28
29 RegisterContextMach_i386::~RegisterContextMach_i386()
30 {
31 }
32
33 int
34 RegisterContextMach_i386::DoReadGPR (lldb::tid_t tid, int flavor, GPR &gpr)
35 {
36     mach_msg_type_number_t count = GPRWordCount;
37     return ::thread_get_state(tid, flavor, (thread_state_t)&gpr, &count);
38 }
39
40 int
41 RegisterContextMach_i386::DoReadFPU (lldb::tid_t tid, int flavor, FPU &fpu)
42 {
43     mach_msg_type_number_t count = FPUWordCount;
44     return ::thread_get_state(tid, flavor, (thread_state_t)&fpu, &count);
45 }
46
47 int
48 RegisterContextMach_i386::DoReadEXC (lldb::tid_t tid, int flavor, EXC &exc)
49 {
50     mach_msg_type_number_t count = EXCWordCount;
51     return ::thread_get_state(tid, flavor, (thread_state_t)&exc, &count);
52 }
53
54 int
55 RegisterContextMach_i386::DoWriteGPR (lldb::tid_t tid, int flavor, const GPR &gpr)
56 {
57     return ::thread_set_state(tid, flavor, (thread_state_t)&gpr, GPRWordCount);
58 }
59
60 int
61 RegisterContextMach_i386::DoWriteFPU (lldb::tid_t tid, int flavor, const FPU &fpu)
62 {
63     return ::thread_set_state(tid, flavor, (thread_state_t)&fpu, FPUWordCount);
64 }
65
66 int
67 RegisterContextMach_i386::DoWriteEXC (lldb::tid_t tid, int flavor, const EXC &exc)
68 {
69     return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount);
70 }
71
72 #endif