]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / source / Plugins / Process / MacOSX-Kernel / RegisterContextKDP_arm.cpp
1 //===-- RegisterContextKDP_arm.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 #include "RegisterContextKDP_arm.h"
11
12 // C Includes
13 // C++ Includes
14 // Other libraries and framework includes
15 // Project includes
16 #include "ProcessKDP.h"
17 #include "ThreadKDP.h"
18
19 using namespace lldb;
20 using namespace lldb_private;
21
22 RegisterContextKDP_arm::RegisterContextKDP_arm(ThreadKDP &thread,
23                                                uint32_t concrete_frame_idx)
24     : RegisterContextDarwin_arm(thread, concrete_frame_idx),
25       m_kdp_thread(thread) {}
26
27 RegisterContextKDP_arm::~RegisterContextKDP_arm() {}
28
29 int RegisterContextKDP_arm::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) {
30   ProcessSP process_sp(CalculateProcess());
31   if (process_sp) {
32     Error error;
33     if (static_cast<ProcessKDP *>(process_sp.get())
34             ->GetCommunication()
35             .SendRequestReadRegisters(tid, GPRRegSet, &gpr, sizeof(gpr),
36                                       error)) {
37       if (error.Success())
38         return 0;
39     }
40   }
41   return -1;
42 }
43
44 int RegisterContextKDP_arm::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) {
45   ProcessSP process_sp(CalculateProcess());
46   if (process_sp) {
47     Error error;
48     if (static_cast<ProcessKDP *>(process_sp.get())
49             ->GetCommunication()
50             .SendRequestReadRegisters(tid, FPURegSet, &fpu, sizeof(fpu),
51                                       error)) {
52       if (error.Success())
53         return 0;
54     }
55   }
56   return -1;
57 }
58
59 int RegisterContextKDP_arm::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) {
60   ProcessSP process_sp(CalculateProcess());
61   if (process_sp) {
62     Error error;
63     if (static_cast<ProcessKDP *>(process_sp.get())
64             ->GetCommunication()
65             .SendRequestReadRegisters(tid, EXCRegSet, &exc, sizeof(exc),
66                                       error)) {
67       if (error.Success())
68         return 0;
69     }
70   }
71   return -1;
72 }
73
74 int RegisterContextKDP_arm::DoReadDBG(lldb::tid_t tid, int flavor, DBG &dbg) {
75   ProcessSP process_sp(CalculateProcess());
76   if (process_sp) {
77     Error error;
78     if (static_cast<ProcessKDP *>(process_sp.get())
79             ->GetCommunication()
80             .SendRequestReadRegisters(tid, DBGRegSet, &dbg, sizeof(dbg),
81                                       error)) {
82       if (error.Success())
83         return 0;
84     }
85   }
86   return -1;
87 }
88
89 int RegisterContextKDP_arm::DoWriteGPR(lldb::tid_t tid, int flavor,
90                                        const GPR &gpr) {
91   ProcessSP process_sp(CalculateProcess());
92   if (process_sp) {
93     Error error;
94     if (static_cast<ProcessKDP *>(process_sp.get())
95             ->GetCommunication()
96             .SendRequestWriteRegisters(tid, GPRRegSet, &gpr, sizeof(gpr),
97                                        error)) {
98       if (error.Success())
99         return 0;
100     }
101   }
102   return -1;
103 }
104
105 int RegisterContextKDP_arm::DoWriteFPU(lldb::tid_t tid, int flavor,
106                                        const FPU &fpu) {
107   ProcessSP process_sp(CalculateProcess());
108   if (process_sp) {
109     Error error;
110     if (static_cast<ProcessKDP *>(process_sp.get())
111             ->GetCommunication()
112             .SendRequestWriteRegisters(tid, FPURegSet, &fpu, sizeof(fpu),
113                                        error)) {
114       if (error.Success())
115         return 0;
116     }
117   }
118   return -1;
119 }
120
121 int RegisterContextKDP_arm::DoWriteEXC(lldb::tid_t tid, int flavor,
122                                        const EXC &exc) {
123   ProcessSP process_sp(CalculateProcess());
124   if (process_sp) {
125     Error error;
126     if (static_cast<ProcessKDP *>(process_sp.get())
127             ->GetCommunication()
128             .SendRequestWriteRegisters(tid, EXCRegSet, &exc, sizeof(exc),
129                                        error)) {
130       if (error.Success())
131         return 0;
132     }
133   }
134   return -1;
135 }
136
137 int RegisterContextKDP_arm::DoWriteDBG(lldb::tid_t tid, int flavor,
138                                        const DBG &dbg) {
139   ProcessSP process_sp(CalculateProcess());
140   if (process_sp) {
141     Error error;
142     if (static_cast<ProcessKDP *>(process_sp.get())
143             ->GetCommunication()
144             .SendRequestWriteRegisters(tid, DBGRegSet, &dbg, sizeof(dbg),
145                                        error)) {
146       if (error.Success())
147         return 0;
148     }
149   }
150   return -1;
151 }