LLDB mainline
RegisterInfo.h
Go to the documentation of this file.
1//===------------------------------------------------------------*- C++ -*-===//
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#ifndef LLDB_UTILITY_REGISTERINFO_H
10#define LLDB_UTILITY_REGISTERINFO_H
11
14
15#include "llvm/ADT/ArrayRef.h"
16
17#include <cstdint>
18
19namespace lldb_private {
20
21/// Every register is described in detail including its name, alternate name
22/// (optional), encoding, size in bytes and the default display format.
24 /// Name of this register, can't be NULL.
25 const char *name;
26 /// Alternate name of this register, can be NULL.
27 const char *alt_name;
28 /// Size in bytes of the register.
29 uint32_t byte_size;
30 /// The byte offset in the register context data where this register's value
31 /// is found.
32 /// This is optional, and can be 0 if a particular RegisterContext does not
33 /// need to address its registers by byte offset.
34 uint32_t byte_offset;
35 /// Encoding of the register bits.
37 /// Default display format.
39 /// Holds all of the various register numbers for all register kinds.
41 /// List of registers (terminated with LLDB_INVALID_REGNUM). If this value is
42 /// not null, all registers in this list will be read first, at which point
43 /// the value for this register will be valid. FOr example, the value list for
44 /// ah would be eax (x86) or rax (x64). Register numbers are of
45 /// eRegisterKindLLDB. If multiple registers are listed, the final value will
46 /// be the concatenation of them.
47 uint32_t *value_regs;
48 /// List of registers (terminated with LLDB_INVALID_REGNUM). If this value is
49 /// not null, all registers in this list will be invalidated when the value of
50 /// this register changes. For example, the invalidate list for eax would be
51 /// rax ax, ah, and al
52 uint32_t *invalidate_regs;
53 /// If not nullptr, a type defined by XML descriptions.
54 /// Register info tables are constructed as const, but this field may need to
55 /// be updated if a specific target OS has a different layout. To enable that,
56 /// this is mutable. The data pointed to is still const, so you must swap a
57 /// whole set of flags for another.
58 mutable const RegisterFlags *flags_type;
59
60 llvm::ArrayRef<uint8_t> data(const uint8_t *context_base) const {
61 return llvm::ArrayRef<uint8_t>(context_base + byte_offset, byte_size);
62 }
63
64 llvm::MutableArrayRef<uint8_t> mutable_data(uint8_t *context_base) const {
65 return llvm::MutableArrayRef<uint8_t>(context_base + byte_offset,
66 byte_size);
67 }
68};
69static_assert(std::is_trivial<RegisterInfo>::value,
70 "RegisterInfo must be trivial.");
71
72/// Registers are grouped into register sets
74 /// Name of this register set.
75 const char *name;
76 /// A short name for this register set.
77 const char *short_name;
78 /// The number of registers in REGISTERS array below.
80 /// An array of register indicies in this set. The values in this array are
81 /// *indices* (not register numbers) into a particular RegisterContext's
82 /// register array. For example, if eax is defined at index 4 for a particular
83 /// RegisterContext, eax would be included in this RegisterSet by adding the
84 /// value 4. Not by adding the value lldb_eax_i386.
85 const uint32_t *registers;
86};
87
88} // namespace lldb_private
89
90#endif // LLDB_UTILITY_REGISTERINFO_H
A class that represents a running process on the host machine.
Format
Display format definitions.
Encoding
Register encoding definitions.
Every register is described in detail including its name, alternate name (optional),...
llvm::MutableArrayRef< uint8_t > mutable_data(uint8_t *context_base) const
lldb::Encoding encoding
Encoding of the register bits.
const char * alt_name
Alternate name of this register, can be NULL.
uint32_t * value_regs
List of registers (terminated with LLDB_INVALID_REGNUM).
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 RegisterFlags * flags_type
If not nullptr, a type defined by XML descriptions.
llvm::ArrayRef< uint8_t > data(const uint8_t *context_base) const
const char * name
Name of this register, can't be NULL.
lldb::Format format
Default display format.
uint32_t * invalidate_regs
List of registers (terminated with LLDB_INVALID_REGNUM).
Registers are grouped into register sets.
size_t num_registers
The number of registers in REGISTERS array below.
const uint32_t * registers
An array of register indicies in this set.
const char * name
Name of this register set.
const char * short_name
A short name for this register set.