LLDB  mainline
RegisterContextFreeBSDKernel_i386.cpp
Go to the documentation of this file.
1 //===-- RegisterContextFreeBSDKernel_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 
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::ulittle32_t edi;
45  llvm::support::ulittle32_t esi;
46  llvm::support::ulittle32_t ebp;
47  llvm::support::ulittle32_t esp;
48  llvm::support::ulittle32_t ebx;
49  llvm::support::ulittle32_t eip;
50  } pcb;
51 
52  Status error;
53  size_t rd =
54  m_thread.GetProcess()->ReadMemory(m_pcb_addr, &pcb, sizeof(pcb), error);
55  if (rd != sizeof(pcb))
56  return false;
57 
58  uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
59  switch (reg) {
60 #define REG(x) \
61  case lldb_##x##_i386: \
62  value = pcb.x; \
63  break;
64 
65  REG(edi);
66  REG(esi);
67  REG(ebp);
68  REG(esp);
69  REG(eip);
70 
71 #undef REG
72 
73  default:
74  return false;
75  }
76 
77  return true;
78 }
79 
81  const RegisterInfo *reg_info, const RegisterValue &value) {
82  return false;
83 }
lldb_private::RegisterValue
Definition: RegisterValue.h:28
esp
@ esp
Definition: CompactUnwindInfo.cpp:979
RegisterContextFreeBSDKernel_i386::ReadRegister
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
Definition: RegisterContextFreeBSDKernel_i386.cpp:38
lldb_private::RegisterInfoInterface
Definition: RegisterInfoInterface.h:21
RegisterContextFreeBSDKernel_i386::WriteGPR
bool WriteGPR() override
Definition: RegisterContextFreeBSDKernel_i386.cpp:28
ebp
@ ebp
Definition: CompactUnwindInfo.cpp:978
RegisterValue.h
ebx
@ ebx
Definition: CompactUnwindInfo.cpp:977
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
Process.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
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_i386::WriteRegister
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override
Definition: RegisterContextFreeBSDKernel_i386.cpp:80
Thread.h
lldb_private::Status
Definition: Status.h:44
uint32_t
REG
#define REG(x)
edi
@ edi
Definition: CompactUnwindInfo.cpp:981
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
RegisterContextFreeBSDKernel_i386.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
RegisterContextFreeBSDKernel_i386::RegisterContextFreeBSDKernel_i386
RegisterContextFreeBSDKernel_i386(lldb_private::Thread &thread, lldb_private::RegisterInfoInterface *register_info, lldb::addr_t pcb_addr)
Definition: RegisterContextFreeBSDKernel_i386.cpp:19
RegisterContextFreeBSDKernel_i386::ReadFPR
bool ReadFPR() override
Definition: RegisterContextFreeBSDKernel_i386.cpp:26
RegisterContextFreeBSDKernel_i386::WriteFPR
bool WriteFPR() override
Definition: RegisterContextFreeBSDKernel_i386.cpp:33
RegisterContextPOSIX_x86
Definition: RegisterContextPOSIX_x86.h:18
esi
@ esi
Definition: CompactUnwindInfo.cpp:980
lldb
Definition: SBAddress.h:15
RegisterContextFreeBSDKernel_i386::m_pcb_addr
lldb::addr_t m_pcb_addr
Definition: RegisterContextFreeBSDKernel_i386.h:38
RegisterContextFreeBSDKernel_i386::ReadGPR
bool ReadGPR() override
Definition: RegisterContextFreeBSDKernel_i386.cpp:24
eip
@ eip
Definition: CompactUnwindInfo.cpp:982