Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / Process / MacOSX-Kernel / RegisterContextKDP_arm.cpp
blob64f0caac75fdcee1adef50d796fb7d8da2b40735
1 //===-- RegisterContextKDP_arm.cpp ----------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "RegisterContextKDP_arm.h"
11 #include "ProcessKDP.h"
12 #include "ThreadKDP.h"
14 using namespace lldb;
15 using namespace lldb_private;
17 RegisterContextKDP_arm::RegisterContextKDP_arm(ThreadKDP &thread,
18 uint32_t concrete_frame_idx)
19 : RegisterContextDarwin_arm(thread, concrete_frame_idx),
20 m_kdp_thread(thread) {}
22 RegisterContextKDP_arm::~RegisterContextKDP_arm() = default;
24 int RegisterContextKDP_arm::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) {
25 ProcessSP process_sp(CalculateProcess());
26 if (process_sp) {
27 Status error;
28 if (static_cast<ProcessKDP *>(process_sp.get())
29 ->GetCommunication()
30 .SendRequestReadRegisters(tid, GPRRegSet, &gpr, sizeof(gpr),
31 error)) {
32 if (error.Success())
33 return 0;
36 return -1;
39 int RegisterContextKDP_arm::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) {
40 ProcessSP process_sp(CalculateProcess());
41 if (process_sp) {
42 Status error;
43 if (static_cast<ProcessKDP *>(process_sp.get())
44 ->GetCommunication()
45 .SendRequestReadRegisters(tid, FPURegSet, &fpu, sizeof(fpu),
46 error)) {
47 if (error.Success())
48 return 0;
51 return -1;
54 int RegisterContextKDP_arm::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) {
55 ProcessSP process_sp(CalculateProcess());
56 if (process_sp) {
57 Status error;
58 if (static_cast<ProcessKDP *>(process_sp.get())
59 ->GetCommunication()
60 .SendRequestReadRegisters(tid, EXCRegSet, &exc, sizeof(exc),
61 error)) {
62 if (error.Success())
63 return 0;
66 return -1;
69 int RegisterContextKDP_arm::DoReadDBG(lldb::tid_t tid, int flavor, DBG &dbg) {
70 ProcessSP process_sp(CalculateProcess());
71 if (process_sp) {
72 Status error;
73 if (static_cast<ProcessKDP *>(process_sp.get())
74 ->GetCommunication()
75 .SendRequestReadRegisters(tid, DBGRegSet, &dbg, sizeof(dbg),
76 error)) {
77 if (error.Success())
78 return 0;
81 return -1;
84 int RegisterContextKDP_arm::DoWriteGPR(lldb::tid_t tid, int flavor,
85 const GPR &gpr) {
86 ProcessSP process_sp(CalculateProcess());
87 if (process_sp) {
88 Status error;
89 if (static_cast<ProcessKDP *>(process_sp.get())
90 ->GetCommunication()
91 .SendRequestWriteRegisters(tid, GPRRegSet, &gpr, sizeof(gpr),
92 error)) {
93 if (error.Success())
94 return 0;
97 return -1;
100 int RegisterContextKDP_arm::DoWriteFPU(lldb::tid_t tid, int flavor,
101 const FPU &fpu) {
102 ProcessSP process_sp(CalculateProcess());
103 if (process_sp) {
104 Status error;
105 if (static_cast<ProcessKDP *>(process_sp.get())
106 ->GetCommunication()
107 .SendRequestWriteRegisters(tid, FPURegSet, &fpu, sizeof(fpu),
108 error)) {
109 if (error.Success())
110 return 0;
113 return -1;
116 int RegisterContextKDP_arm::DoWriteEXC(lldb::tid_t tid, int flavor,
117 const EXC &exc) {
118 ProcessSP process_sp(CalculateProcess());
119 if (process_sp) {
120 Status error;
121 if (static_cast<ProcessKDP *>(process_sp.get())
122 ->GetCommunication()
123 .SendRequestWriteRegisters(tid, EXCRegSet, &exc, sizeof(exc),
124 error)) {
125 if (error.Success())
126 return 0;
129 return -1;
132 int RegisterContextKDP_arm::DoWriteDBG(lldb::tid_t tid, int flavor,
133 const DBG &dbg) {
134 ProcessSP process_sp(CalculateProcess());
135 if (process_sp) {
136 Status error;
137 if (static_cast<ProcessKDP *>(process_sp.get())
138 ->GetCommunication()
139 .SendRequestWriteRegisters(tid, DBGRegSet, &dbg, sizeof(dbg),
140 error)) {
141 if (error.Success())
142 return 0;
145 return -1;