LLDB  mainline
RegisterContextKDP_arm64.cpp
Go to the documentation of this file.
1 //===-- RegisterContextKDP_arm64.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_arm64(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
ProcessKDP
Definition: ProcessKDP.h:30
RegisterContextKDP_arm64::DoWriteDBG
int DoWriteDBG(lldb::tid_t tid, int flavor, const DBG &dbg) override
Definition: RegisterContextKDP_arm64.cpp:132
ProcessKDP.h
RegisterContextKDP_arm64::DoReadEXC
int DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) override
Definition: RegisterContextKDP_arm64.cpp:54
ThreadKDP.h
RegisterContextKDP_arm64::DoReadFPU
int DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) override
Definition: RegisterContextKDP_arm64.cpp:39
RegisterContextDarwin_arm64
Definition: RegisterContextDarwin_arm64.h:28
RegisterContextDarwin_arm64::gpr
GPR gpr
Definition: RegisterContextDarwin_arm64.h:122
RegisterContextDarwin_arm64::EXC
Definition: RegisterContextDarwin_arm64.h:87
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
lldb_private::RegisterContext::CalculateProcess
lldb::ProcessSP CalculateProcess() override
Definition: RegisterContext.cpp:431
RegisterContextDarwin_arm64::GPRRegSet
@ GPRRegSet
Definition: RegisterContextDarwin_arm64.h:106
RegisterContextKDP_arm64::DoWriteGPR
int DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr) override
Definition: RegisterContextKDP_arm64.cpp:84
RegisterContextKDP_arm64::DoReadGPR
int DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) override
Definition: RegisterContextKDP_arm64.cpp:24
RegisterContextKDP_arm64::DoWriteFPU
int DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu) override
Definition: RegisterContextKDP_arm64.cpp:100
RegisterContextKDP_arm64::DoReadDBG
int DoReadDBG(lldb::tid_t tid, int flavor, DBG &dbg) override
Definition: RegisterContextKDP_arm64.cpp:69
RegisterContextDarwin_arm64::EXCRegSet
@ EXCRegSet
Definition: RegisterContextDarwin_arm64.h:108
RegisterContextKDP_arm64::~RegisterContextKDP_arm64
virtual ~RegisterContextKDP_arm64()
RegisterContextKDP_arm64::DoWriteEXC
int DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc) override
Definition: RegisterContextKDP_arm64.cpp:116
ThreadKDP
Definition: ThreadKDP.h:19
RegisterContextDarwin_arm64::FPURegSet
@ FPURegSet
Definition: RegisterContextDarwin_arm64.h:107
RegisterContextDarwin_arm64::DBG
Definition: RegisterContextDarwin_arm64.h:94
lldb_private::Status
Definition: Status.h:44
RegisterContextDarwin_arm64::dbg
DBG dbg
Definition: RegisterContextDarwin_arm64.h:125
uint32_t
RegisterContextDarwin_arm64::GPR
Definition: RegisterContextDarwin_arm64.h:66
RegisterContextKDP_arm64::RegisterContextKDP_arm64
RegisterContextKDP_arm64(ThreadKDP &thread, uint32_t concrete_frame_idx)
Definition: RegisterContextKDP_arm64.cpp:17
RegisterContextDarwin_arm64::FPU
Definition: RegisterContextDarwin_arm64.h:80
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
RegisterContextKDP_arm64.h
RegisterContextDarwin_arm64::exc
EXC exc
Definition: RegisterContextDarwin_arm64.h:124
RegisterContextDarwin_arm64::DBGRegSet
@ DBGRegSet
Definition: RegisterContextDarwin_arm64.h:109
lldb
Definition: SBAddress.h:15
RegisterContextDarwin_arm64::fpu
FPU fpu
Definition: RegisterContextDarwin_arm64.h:123
ProcessKDP::GetCommunication
CommunicationKDP & GetCommunication()
Definition: ProcessKDP.h:136
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86