Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / Process / MacOSX-Kernel / RegisterContextKDP_i386.cpp
blob61dfeae6ddf43bd29f56c21e768df1c849f9fd75
1 //===-- RegisterContextKDP_i386.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_i386.h"
10 #include "ProcessKDP.h"
11 #include "ThreadKDP.h"
13 using namespace lldb;
14 using namespace lldb_private;
16 RegisterContextKDP_i386::RegisterContextKDP_i386(ThreadKDP &thread,
17 uint32_t concrete_frame_idx)
18 : RegisterContextDarwin_i386(thread, concrete_frame_idx),
19 m_kdp_thread(thread) {}
21 RegisterContextKDP_i386::~RegisterContextKDP_i386() = default;
23 int RegisterContextKDP_i386::DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) {
24 ProcessSP process_sp(CalculateProcess());
25 if (process_sp) {
26 Status error;
27 if (static_cast<ProcessKDP *>(process_sp.get())
28 ->GetCommunication()
29 .SendRequestReadRegisters(tid, GPRRegSet, &gpr, sizeof(gpr),
30 error)) {
31 if (error.Success())
32 return 0;
35 return -1;
38 int RegisterContextKDP_i386::DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) {
39 ProcessSP process_sp(CalculateProcess());
40 if (process_sp) {
41 Status error;
42 if (static_cast<ProcessKDP *>(process_sp.get())
43 ->GetCommunication()
44 .SendRequestReadRegisters(tid, FPURegSet, &fpu, sizeof(fpu),
45 error)) {
46 if (error.Success())
47 return 0;
50 return -1;
53 int RegisterContextKDP_i386::DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) {
54 ProcessSP process_sp(CalculateProcess());
55 if (process_sp) {
56 Status error;
57 if (static_cast<ProcessKDP *>(process_sp.get())
58 ->GetCommunication()
59 .SendRequestReadRegisters(tid, EXCRegSet, &exc, sizeof(exc),
60 error)) {
61 if (error.Success())
62 return 0;
65 return -1;
68 int RegisterContextKDP_i386::DoWriteGPR(lldb::tid_t tid, int flavor,
69 const GPR &gpr) {
70 ProcessSP process_sp(CalculateProcess());
71 if (process_sp) {
72 Status error;
73 if (static_cast<ProcessKDP *>(process_sp.get())
74 ->GetCommunication()
75 .SendRequestWriteRegisters(tid, GPRRegSet, &gpr, sizeof(gpr),
76 error)) {
77 if (error.Success())
78 return 0;
81 return -1;
84 int RegisterContextKDP_i386::DoWriteFPU(lldb::tid_t tid, int flavor,
85 const FPU &fpu) {
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, FPURegSet, &fpu, sizeof(fpu),
92 error)) {
93 if (error.Success())
94 return 0;
97 return -1;
100 int RegisterContextKDP_i386::DoWriteEXC(lldb::tid_t tid, int flavor,
101 const EXC &exc) {
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, EXCRegSet, &exc, sizeof(exc),
108 error)) {
109 if (error.Success())
110 return 0;
113 return -1;