LLDB  mainline
RegisterContextKDP_arm.cpp
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
8 
10 
11 #include "ProcessKDP.h"
12 #include "ThreadKDP.h"
13 
14 using namespace lldb;
15 using namespace lldb_private;
16 
18  uint32_t concrete_frame_idx)
19  : RegisterContextDarwin_arm(thread, concrete_frame_idx),
20  m_kdp_thread(thread) {}
21 
23 
25  ProcessSP process_sp(CalculateProcess());
26  if (process_sp) {
27  Status error;
28  if (static_cast<ProcessKDP *>(process_sp.get())
30  .SendRequestReadRegisters(tid, GPRRegSet, &gpr, sizeof(gpr),
31  error)) {
32  if (error.Success())
33  return 0;
34  }
35  }
36  return -1;
37 }
38 
40  ProcessSP process_sp(CalculateProcess());
41  if (process_sp) {
42  Status error;
43  if (static_cast<ProcessKDP *>(process_sp.get())
45  .SendRequestReadRegisters(tid, FPURegSet, &fpu, sizeof(fpu),
46  error)) {
47  if (error.Success())
48  return 0;
49  }
50  }
51  return -1;
52 }
53 
55  ProcessSP process_sp(CalculateProcess());
56  if (process_sp) {
57  Status error;
58  if (static_cast<ProcessKDP *>(process_sp.get())
60  .SendRequestReadRegisters(tid, EXCRegSet, &exc, sizeof(exc),
61  error)) {
62  if (error.Success())
63  return 0;
64  }
65  }
66  return -1;
67 }
68 
70  ProcessSP process_sp(CalculateProcess());
71  if (process_sp) {
72  Status error;
73  if (static_cast<ProcessKDP *>(process_sp.get())
75  .SendRequestReadRegisters(tid, DBGRegSet, &dbg, sizeof(dbg),
76  error)) {
77  if (error.Success())
78  return 0;
79  }
80  }
81  return -1;
82 }
83 
85  const GPR &gpr) {
86  ProcessSP process_sp(CalculateProcess());
87  if (process_sp) {
88  Status error;
89  if (static_cast<ProcessKDP *>(process_sp.get())
91  .SendRequestWriteRegisters(tid, GPRRegSet, &gpr, sizeof(gpr),
92  error)) {
93  if (error.Success())
94  return 0;
95  }
96  }
97  return -1;
98 }
99 
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;
111  }
112  }
113  return -1;
114 }
115 
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;
127  }
128  }
129  return -1;
130 }
131 
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;
143  }
144  }
145  return -1;
146 }
CommunicationKDP::SendRequestReadRegisters
uint32_t SendRequestReadRegisters(uint32_t cpu, uint32_t flavor, void *dst, uint32_t dst_size, lldb_private::Status &error)
Definition: CommunicationKDP.cpp:1167
RegisterContextDarwin_arm::dbg
DBG dbg
Definition: RegisterContextDarwin_arm.h:158
RegisterContextKDP_arm::DoWriteGPR
int DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr) override
Definition: RegisterContextKDP_arm.cpp:84
RegisterContextDarwin_arm::EXC
Definition: RegisterContextDarwin_arm.h:122
ProcessKDP
Definition: ProcessKDP.h:30
RegisterContextDarwin_arm::exc
EXC exc
Definition: RegisterContextDarwin_arm.h:157
ProcessKDP.h
ThreadKDP.h
RegisterContextKDP_arm::DoWriteDBG
int DoWriteDBG(lldb::tid_t tid, int flavor, const DBG &dbg) override
Definition: RegisterContextKDP_arm.cpp:132
RegisterContextKDP_arm::DoReadFPU
int DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) override
Definition: RegisterContextKDP_arm.cpp:39
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
CommunicationKDP::SendRequestWriteRegisters
uint32_t SendRequestWriteRegisters(uint32_t cpu, uint32_t flavor, const void *src, uint32_t src_size, lldb_private::Status &error)
Definition: CommunicationKDP.cpp:1209
RegisterContextKDP_arm::DoReadGPR
int DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) override
Definition: RegisterContextKDP_arm.cpp:24
RegisterContextDarwin_arm::EXCRegSet
@ EXCRegSet
Definition: RegisterContextDarwin_arm.h:142
lldb_private::RegisterContext::CalculateProcess
lldb::ProcessSP CalculateProcess() override
Definition: RegisterContext.cpp:431
RegisterContextDarwin_arm::fpu
FPU fpu
Definition: RegisterContextDarwin_arm.h:156
RegisterContextDarwin_arm::DBGRegSet
@ DBGRegSet
Definition: RegisterContextDarwin_arm.h:143
RegisterContextDarwin_arm::DBG
Definition: RegisterContextDarwin_arm.h:128
RegisterContextKDP_arm::DoWriteEXC
int DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc) override
Definition: RegisterContextKDP_arm.cpp:116
RegisterContextKDP_arm::~RegisterContextKDP_arm
virtual ~RegisterContextKDP_arm()
ThreadKDP
Definition: ThreadKDP.h:19
RegisterContextDarwin_arm::FPURegSet
@ FPURegSet
Definition: RegisterContextDarwin_arm.h:141
RegisterContextDarwin_arm::GPR
Definition: RegisterContextDarwin_arm.h:89
lldb_private::Status
Definition: Status.h:44
uint32_t
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
RegisterContextKDP_arm::DoReadEXC
int DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) override
Definition: RegisterContextKDP_arm.cpp:54
RegisterContextDarwin_arm::FPU
Definition: RegisterContextDarwin_arm.h:98
RegisterContextKDP_arm::DoWriteFPU
int DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu) override
Definition: RegisterContextKDP_arm.cpp:100
RegisterContextKDP_arm::RegisterContextKDP_arm
RegisterContextKDP_arm(ThreadKDP &thread, uint32_t concrete_frame_idx)
Definition: RegisterContextKDP_arm.cpp:17
RegisterContextDarwin_arm::GPRRegSet
@ GPRRegSet
Definition: RegisterContextDarwin_arm.h:139
lldb
Definition: SBAddress.h:15
RegisterContextKDP_arm::DoReadDBG
int DoReadDBG(lldb::tid_t tid, int flavor, DBG &dbg) override
Definition: RegisterContextKDP_arm.cpp:69
RegisterContextDarwin_arm::gpr
GPR gpr
Definition: RegisterContextDarwin_arm.h:155
RegisterContextDarwin_arm
Definition: RegisterContextDarwin_arm.h:46
ProcessKDP::GetCommunication
CommunicationKDP & GetCommunication()
Definition: ProcessKDP.h:136
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86
RegisterContextKDP_arm.h