LLDB  mainline
RegisterContextKDP_i386.cpp
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
8 
10 #include "ProcessKDP.h"
11 #include "ThreadKDP.h"
12 
13 using namespace lldb;
14 using namespace lldb_private;
15 
17  uint32_t concrete_frame_idx)
18  : RegisterContextDarwin_i386(thread, concrete_frame_idx),
19  m_kdp_thread(thread) {}
20 
22 
24  ProcessSP process_sp(CalculateProcess());
25  if (process_sp) {
26  Status error;
27  if (static_cast<ProcessKDP *>(process_sp.get())
29  .SendRequestReadRegisters(tid, GPRRegSet, &gpr, sizeof(gpr),
30  error)) {
31  if (error.Success())
32  return 0;
33  }
34  }
35  return -1;
36 }
37 
39  ProcessSP process_sp(CalculateProcess());
40  if (process_sp) {
41  Status error;
42  if (static_cast<ProcessKDP *>(process_sp.get())
44  .SendRequestReadRegisters(tid, FPURegSet, &fpu, sizeof(fpu),
45  error)) {
46  if (error.Success())
47  return 0;
48  }
49  }
50  return -1;
51 }
52 
54  ProcessSP process_sp(CalculateProcess());
55  if (process_sp) {
56  Status error;
57  if (static_cast<ProcessKDP *>(process_sp.get())
59  .SendRequestReadRegisters(tid, EXCRegSet, &exc, sizeof(exc),
60  error)) {
61  if (error.Success())
62  return 0;
63  }
64  }
65  return -1;
66 }
67 
69  const GPR &gpr) {
70  ProcessSP process_sp(CalculateProcess());
71  if (process_sp) {
72  Status error;
73  if (static_cast<ProcessKDP *>(process_sp.get())
75  .SendRequestWriteRegisters(tid, GPRRegSet, &gpr, sizeof(gpr),
76  error)) {
77  if (error.Success())
78  return 0;
79  }
80  }
81  return -1;
82 }
83 
85  const FPU &fpu) {
86  ProcessSP process_sp(CalculateProcess());
87  if (process_sp) {
88  Status error;
89  if (static_cast<ProcessKDP *>(process_sp.get())
91  .SendRequestWriteRegisters(tid, FPURegSet, &fpu, sizeof(fpu),
92  error)) {
93  if (error.Success())
94  return 0;
95  }
96  }
97  return -1;
98 }
99 
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;
111  }
112  }
113  return -1;
114 }
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_i386::EXC
Definition: RegisterContextDarwin_i386.h:96
RegisterContextDarwin_i386::GPR
Definition: RegisterContextDarwin_i386.h:47
ProcessKDP
Definition: ProcessKDP.h:30
RegisterContextKDP_i386::DoReadFPU
int DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) override
Definition: RegisterContextKDP_i386.cpp:38
ProcessKDP.h
ThreadKDP.h
RegisterContextKDP_i386::~RegisterContextKDP_i386
virtual ~RegisterContextKDP_i386()
RegisterContextKDP_i386::DoReadEXC
int DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) override
Definition: RegisterContextKDP_i386.cpp:53
RegisterContextDarwin_i386::FPURegSet
@ FPURegSet
Definition: RegisterContextDarwin_i386.h:103
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
RegisterContextDarwin_i386::gpr
GPR gpr
Definition: RegisterContextDarwin_i386.h:113
lldb_private::RegisterContext::CalculateProcess
lldb::ProcessSP CalculateProcess() override
Definition: RegisterContext.cpp:457
RegisterContextDarwin_i386::fpu
FPU fpu
Definition: RegisterContextDarwin_i386.h:114
RegisterContextDarwin_i386::FPU
Definition: RegisterContextDarwin_i386.h:75
RegisterContextKDP_i386::RegisterContextKDP_i386
RegisterContextKDP_i386(ThreadKDP &thread, uint32_t concrete_frame_idx)
Definition: RegisterContextKDP_i386.cpp:16
RegisterContextKDP_i386.h
RegisterContextKDP_i386::DoWriteGPR
int DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr) override
Definition: RegisterContextKDP_i386.cpp:68
RegisterContextKDP_i386::DoWriteFPU
int DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu) override
Definition: RegisterContextKDP_i386.cpp:84
ThreadKDP
Definition: ThreadKDP.h:19
RegisterContextKDP_i386::DoWriteEXC
int DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc) override
Definition: RegisterContextKDP_i386.cpp:100
RegisterContextDarwin_i386
Definition: RegisterContextDarwin_i386.h:15
RegisterContextDarwin_i386::GPRRegSet
@ GPRRegSet
Definition: RegisterContextDarwin_i386.h:103
lldb_private::Status
Definition: Status.h:44
uint32_t
RegisterContextDarwin_i386::exc
EXC exc
Definition: RegisterContextDarwin_i386.h:115
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb
Definition: SBAddress.h:15
RegisterContextKDP_i386::DoReadGPR
int DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) override
Definition: RegisterContextKDP_i386.cpp:23
ProcessKDP::GetCommunication
CommunicationKDP & GetCommunication()
Definition: ProcessKDP.h:136
RegisterContextDarwin_i386::EXCRegSet
@ EXCRegSet
Definition: RegisterContextDarwin_i386.h:103
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86