LLDB mainline
RegisterContextPOSIX_mips64.cpp
Go to the documentation of this file.
1//===-- RegisterContextPOSIX_mips64.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
9#include <cerrno>
10#include <cstdint>
11#include <cstring>
12
13#include "lldb/Target/Process.h"
14#include "lldb/Target/Target.h"
15#include "lldb/Target/Thread.h"
18#include "lldb/Utility/Endian.h"
20#include "lldb/Utility/Scalar.h"
21#include "llvm/Support/Compiler.h"
22
25
26using namespace lldb_private;
27using namespace lldb;
28
30 return reg < m_registers_count[gpr_registers_count]; // GPR's come first.
31}
32
34 int set = GetRegisterSetCount();
35 if (set > 1)
38 return false;
39}
40
42 Thread &thread, uint32_t concrete_frame_idx,
43 RegisterInfoInterface *register_info)
44 : RegisterContext(thread, concrete_frame_idx) {
45 m_register_info_up.reset(register_info);
47 int set = GetRegisterSetCount();
48
49 const RegisterSet *reg_set_ptr;
50 for(int i = 0; i < set; ++i) {
51 reg_set_ptr = GetRegisterSet(i);
52 m_registers_count[i] = reg_set_ptr->num_registers;
53 }
54
55 assert(m_num_registers ==
56 static_cast<uint32_t>(m_registers_count[gpr_registers_count] +
59}
60
62
64
66
68 assert(reg < m_num_registers && "Invalid register number.");
69 return GetRegisterInfo()[reg].byte_offset;
70}
71
73 assert(reg < m_num_registers && "Invalid register number.");
74 return GetRegisterInfo()[reg].byte_size;
75}
76
78 return m_register_info_up->GetRegisterCount();
79}
80
82 return m_register_info_up->GetGPRSize();
83}
84
86 // Commonly, this method is overridden and g_register_infos is copied and
87 // specialized. So, use GetRegisterInfo() rather than g_register_infos in
88 // this scope.
89 return m_register_info_up->GetRegisterInfo();
90}
91
92const RegisterInfo *
94 if (reg < m_num_registers)
95 return &GetRegisterInfo()[reg];
96 else
97 return nullptr;
98}
99
101 const auto *context = static_cast<const RegisterContextFreeBSD_mips64 *>(
102 m_register_info_up.get());
103 return context->GetRegisterSetCount();
104}
105
107 const auto *context = static_cast<const RegisterContextFreeBSD_mips64 *>(
108 m_register_info_up.get());
109 return context->GetRegisterSet(set);
110}
111
113 assert(reg < m_num_registers && "Invalid register offset.");
114 return GetRegisterInfo()[reg].name;
115}
116
118 size_t num_sets = GetRegisterSetCount();
119
120 return (set_index < num_sets);
121}
122
123// Used when parsing DWARF and EH frame information and any other object file
124// sections that contain register numbers in them.
126 lldb::RegisterKind kind, uint32_t num) {
127 const uint32_t num_regs = m_num_registers;
128
129 assert(kind < kNumRegisterKinds);
130 for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
131 const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg_idx);
132
133 if (reg_info->kinds[kind] == num)
134 return reg_idx;
135 }
136
137 return LLDB_INVALID_REGNUM;
138}
const lldb_private::RegisterSet * GetRegisterSet(size_t set) const
RegisterContextPOSIX_mips64(lldb_private::Thread &thread, uint32_t concrete_frame_idx, lldb_private::RegisterInfoInterface *register_info)
uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override
Convert from a given register numbering scheme to the lldb register numbering scheme.
virtual unsigned GetRegisterOffset(unsigned reg)
virtual unsigned GetRegisterSize(unsigned reg)
uint8_t m_registers_count[register_set_count]
std::unique_ptr< lldb_private::RegisterInfoInterface > m_register_info_up
virtual const lldb_private::RegisterInfo * GetRegisterInfo()
virtual bool IsRegisterSetAvailable(size_t set_index)
const lldb_private::RegisterSet * GetRegisterSet(size_t set) override
~RegisterContextPOSIX_mips64() override
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
const char * GetRegisterName(unsigned reg)
RegisterInfo interface to patch RegisterInfo structure for archs.
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:87
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
RegisterKind
Register numbering types.
@ kNumRegisterKinds
Every register is described in detail including its name, alternate name (optional),...
uint32_t byte_offset
The byte offset in the register context data where this register's value is found.
uint32_t byte_size
Size in bytes of the register.
uint32_t kinds[lldb::kNumRegisterKinds]
Holds all of the various register numbers for all register kinds.
const char * name
Name of this register, can't be NULL.
Registers are grouped into register sets.
size_t num_registers
The number of registers in REGISTERS array below.