LLDB  mainline
RegisterContextHistory.cpp
Go to the documentation of this file.
1 //===-- RegisterContextHistory.cpp ---------------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "lldb/Core/Address.h"
11 #include "lldb/Core/AddressRange.h"
12 #include "lldb/Core/Module.h"
13 #include "lldb/Core/Value.h"
16 #include "lldb/Symbol/Function.h"
17 #include "lldb/Symbol/ObjectFile.h"
18 #include "lldb/Symbol/Symbol.h"
20 #include "lldb/Target/ABI.h"
23 #include "lldb/Target/Process.h"
24 #include "lldb/Target/StackFrame.h"
25 #include "lldb/Target/Target.h"
26 #include "lldb/Target/Thread.h"
28 #include "lldb/Utility/Log.h"
30 #include "lldb/lldb-private.h"
31 
32 #include "RegisterContextHistory.h"
33 
34 using namespace lldb;
35 using namespace lldb_private;
36 
37 RegisterContextHistory::RegisterContextHistory(Thread &thread,
38  uint32_t concrete_frame_idx,
39  uint32_t address_byte_size,
40  addr_t pc_value)
41  : RegisterContext(thread, concrete_frame_idx), m_pc_value(pc_value) {
42  m_reg_set0.name = "General Purpose Registers";
43  m_reg_set0.short_name = "GPR";
44  m_reg_set0.num_registers = 1;
45  m_reg_set0.registers = new uint32_t(0);
46 
47  m_pc_reg_info.name = "pc";
48  m_pc_reg_info.alt_name = "pc";
49  m_pc_reg_info.byte_offset = 0;
50  m_pc_reg_info.byte_size = address_byte_size;
51  m_pc_reg_info.encoding = eEncodingUint;
52  m_pc_reg_info.format = eFormatPointer;
53  m_pc_reg_info.invalidate_regs = NULL;
54  m_pc_reg_info.value_regs = NULL;
55  m_pc_reg_info.kinds[eRegisterKindEHFrame] = LLDB_INVALID_REGNUM;
56  m_pc_reg_info.kinds[eRegisterKindDWARF] = LLDB_INVALID_REGNUM;
57  m_pc_reg_info.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_PC;
58  m_pc_reg_info.kinds[eRegisterKindProcessPlugin] = LLDB_INVALID_REGNUM;
59  m_pc_reg_info.kinds[eRegisterKindLLDB] = LLDB_INVALID_REGNUM;
60 }
61 
63  delete m_reg_set0.registers;
64  delete m_pc_reg_info.invalidate_regs;
65  delete m_pc_reg_info.value_regs;
66 }
67 
69 
71 
72 const lldb_private::RegisterInfo *
74  if (reg)
75  return NULL;
76  return &m_pc_reg_info;
77 }
78 
80 
81 const lldb_private::RegisterSet *
83  if (reg_set)
84  return NULL;
85  return &m_reg_set0;
86 }
87 
89  const lldb_private::RegisterInfo *reg_info,
91  if (!reg_info)
92  return false;
93  uint32_t reg_number = reg_info->kinds[eRegisterKindGeneric];
94  if (reg_number == LLDB_REGNUM_GENERIC_PC) {
95  value.SetUInt(m_pc_value, reg_info->byte_size);
96  return true;
97  }
98  return false;
99 }
100 
102  const lldb_private::RegisterInfo *reg_info,
103  const lldb_private::RegisterValue &value) {
104  return false;
105 }
106 
108  lldb::DataBufferSP &data_sp) {
109  return false;
110 }
111 
113  const lldb::DataBufferSP &data_sp) {
114  return false;
115 }
116 
118  lldb::RegisterKind kind, uint32_t num) {
119  if (kind == eRegisterKindGeneric && num == LLDB_REGNUM_GENERIC_PC)
120  return 0;
121  return LLDB_INVALID_REGNUM;
122 }
#define LLDB_REGNUM_GENERIC_PC
Definition: lldb-defines.h:63
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override
bool SetUInt(uint64_t uint, uint32_t byte_size)
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override
Convert from a given register numbering scheme to the lldb register numbering scheme.
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
uint64_t addr_t
Definition: lldb-types.h:83
Definition: SBAddress.h:15
const lldb_private::RegisterSet * GetRegisterSet(size_t reg_set) override
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:90
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override