LLDB  mainline
RegisterContextFreeBSDKernel_x86_64.cpp
Go to the documentation of this file.
1 //===-- RegisterContextFreeBSDKernel_x86_64.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 "lldb/Target/Process.h"
12 #include "lldb/Target/Thread.h"
14 #include "llvm/Support/Endian.h"
15 
16 using namespace lldb;
17 using namespace lldb_private;
18 
20  Thread &thread, RegisterInfoInterface *register_info, lldb::addr_t pcb_addr)
21  : RegisterContextPOSIX_x86(thread, 0, register_info), m_pcb_addr(pcb_addr) {
22 }
23 
25 
27 
29  assert(0);
30  return false;
31 }
32 
34  assert(0);
35  return false;
36 }
37 
39  const RegisterInfo *reg_info, RegisterValue &value) {
41  return false;
42 
43  struct {
44  llvm::support::ulittle64_t r15;
45  llvm::support::ulittle64_t r14;
46  llvm::support::ulittle64_t r13;
47  llvm::support::ulittle64_t r12;
48  llvm::support::ulittle64_t rbp;
49  llvm::support::ulittle64_t rsp;
50  llvm::support::ulittle64_t rbx;
51  llvm::support::ulittle64_t rip;
52  } pcb;
53 
54  Status error;
55  size_t rd =
56  m_thread.GetProcess()->ReadMemory(m_pcb_addr, &pcb, sizeof(pcb), error);
57  if (rd != sizeof(pcb))
58  return false;
59 
60  uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
61  switch (reg) {
62 #define REG(x) \
63  case lldb_##x##_x86_64: \
64  value = pcb.x; \
65  break;
66 
67  REG(r15);
68  REG(r14);
69  REG(r13);
70  REG(r12);
71  REG(rbp);
72  REG(rsp);
73  REG(rbx);
74  REG(rip);
75 
76 #undef REG
77 
78  default:
79  return false;
80  }
81 
82  return true;
83 }
84 
86  const RegisterInfo *reg_info, const RegisterValue &value) {
87  return false;
88 }
r12
@ r12
Definition: CompactUnwindInfo.cpp:706
lldb_private::RegisterValue
Definition: RegisterValue.h:28
lldb_private::RegisterInfoInterface
Definition: RegisterInfoInterface.h:21
RegisterContextFreeBSDKernel_x86_64::ReadFPR
bool ReadFPR() override
Definition: RegisterContextFreeBSDKernel_x86_64.cpp:26
REG
#define REG(x)
RegisterValue.h
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
Process.h
RegisterContextFreeBSDKernel_x86_64.h
lldb_private::Thread::GetProcess
lldb::ProcessSP GetProcess() const
Definition: Thread.h:153
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
RegisterContextFreeBSDKernel_x86_64::ReadGPR
bool ReadGPR() override
Definition: RegisterContextFreeBSDKernel_x86_64.cpp:24
lldb_private::RegisterContext::m_thread
Thread & m_thread
Definition: RegisterContext.h:234
lldb::eRegisterKindLLDB
@ eRegisterKindLLDB
lldb's internal register numbers
Definition: lldb-enumerations.h:234
lldb_private::Thread
Definition: Thread.h:61
RegisterContextFreeBSDKernel_x86_64::WriteGPR
bool WriteGPR() override
Definition: RegisterContextFreeBSDKernel_x86_64.cpp:28
rbx
@ rbx
Definition: CompactUnwindInfo.cpp:697
r14
@ r14
Definition: CompactUnwindInfo.cpp:708
Thread.h
RegisterContextFreeBSDKernel_x86_64::WriteFPR
bool WriteFPR() override
Definition: RegisterContextFreeBSDKernel_x86_64.cpp:33
RegisterContextFreeBSDKernel_x86_64::ReadRegister
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
Definition: RegisterContextFreeBSDKernel_x86_64.cpp:38
RegisterContextFreeBSDKernel_x86_64::m_pcb_addr
lldb::addr_t m_pcb_addr
Definition: RegisterContextFreeBSDKernel_x86_64.h:38
lldb_private::Status
Definition: Status.h:44
RegisterContextFreeBSDKernel_x86_64::WriteRegister
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override
Definition: RegisterContextFreeBSDKernel_x86_64.cpp:85
uint32_t
rip
@ rip
Definition: CompactUnwindInfo.cpp:710
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
r15
@ r15
Definition: CompactUnwindInfo.cpp:709
RegisterContextFreeBSDKernel_x86_64::RegisterContextFreeBSDKernel_x86_64
RegisterContextFreeBSDKernel_x86_64(lldb_private::Thread &thread, lldb_private::RegisterInfoInterface *register_info, lldb::addr_t pcb_addr)
Definition: RegisterContextFreeBSDKernel_x86_64.cpp:19
RegisterContextPOSIX_x86
Definition: RegisterContextPOSIX_x86.h:18
lldb
Definition: SBAddress.h:15
rbp
@ rbp
Definition: CompactUnwindInfo.cpp:700
rsp
@ rsp
Definition: CompactUnwindInfo.cpp:701
r13
@ r13
Definition: CompactUnwindInfo.cpp:707