LLDB  mainline
lldb-private-types.h
Go to the documentation of this file.
1 //===-- lldb-private-types.h ------------------------------------*- 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_LLDB_PRIVATE_TYPES_H
10 #define LLDB_LLDB_PRIVATE_TYPES_H
11 
12 #if defined(__cplusplus)
13 
14 #include "lldb/lldb-private.h"
15 
16 #include "llvm/ADT/ArrayRef.h"
17 
18 namespace llvm {
19 namespace sys {
20 class DynamicLibrary;
21 }
22 }
23 
24 namespace lldb_private {
25 class Platform;
26 class ExecutionContext;
27 
28 typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType)(
29  const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Status &error);
30 
31 /// Every register is described in detail including its name, alternate name
32 /// (optional), encoding, size in bytes and the default display format.
33 struct RegisterInfo {
34  /// Name of this register, can't be NULL.
35  const char *name;
36  /// Alternate name of this register, can be NULL.
37  const char *alt_name;
38  /// Size in bytes of the register.
39  uint32_t byte_size;
40  /// The byte offset in the register context data where this register's
41  /// value is found.
42  /// This is optional, and can be 0 if a particular RegisterContext does not
43  /// need to address its registers by byte offset.
44  uint32_t byte_offset;
45  /// Encoding of the register bits.
46  lldb::Encoding encoding;
47  /// Default display format.
48  lldb::Format format;
49  /// Holds all of the various register numbers for all register kinds.
51  /// List of registers (terminated with LLDB_INVALID_REGNUM). If this value is
52  /// not null, all registers in this list will be read first, at which point
53  /// the value for this register will be valid. For example, the value list
54  /// for ah would be eax (x86) or rax (x64).
55  uint32_t *value_regs; //
56  /// List of registers (terminated with LLDB_INVALID_REGNUM). If this value is
57  /// not null, all registers in this list will be invalidated when the value of
58  /// this register changes. For example, the invalidate list for eax would be
59  /// rax ax, ah, and al.
60  uint32_t *invalidate_regs;
61  /// A DWARF expression that when evaluated gives the byte size of this
62  /// register.
63  const uint8_t *dynamic_size_dwarf_expr_bytes;
64  /// The length of the DWARF expression in bytes in the
65  /// dynamic_size_dwarf_expr_bytes member.
66  size_t dynamic_size_dwarf_len;
67 
68  llvm::ArrayRef<uint8_t> data(const uint8_t *context_base) const {
69  return llvm::ArrayRef<uint8_t>(context_base + byte_offset, byte_size);
70  }
71 
72  llvm::MutableArrayRef<uint8_t> mutable_data(uint8_t *context_base) const {
73  return llvm::MutableArrayRef<uint8_t>(context_base + byte_offset,
74  byte_size);
75  }
76 };
77 
78 /// Registers are grouped into register sets
79 struct RegisterSet {
80  /// Name of this register set.
81  const char *name;
82  /// A short name for this register set.
83  const char *short_name;
84  /// The number of registers in REGISTERS array below.
85  size_t num_registers;
86  /// An array of register indices in this set. The values in this array are
87  /// *indices* (not register numbers) into a particular RegisterContext's
88  /// register array. For example, if eax is defined at index 4 for a
89  /// particular RegisterContext, eax would be included in this RegisterSet by
90  /// adding the value 4. Not by adding the value lldb_eax_i386.
91  const uint32_t *registers;
92 };
93 
94 struct OptionEnumValueElement {
95  int64_t value;
96  const char *string_value;
97  const char *usage;
98 };
99 
100 using OptionEnumValues = llvm::ArrayRef<OptionEnumValueElement>;
101 
102 struct OptionValidator {
103  virtual ~OptionValidator() {}
104  virtual bool IsValid(Platform &platform,
105  const ExecutionContext &target) const = 0;
106  virtual const char *ShortConditionString() const = 0;
107  virtual const char *LongConditionString() const = 0;
108 };
109 
110 struct OptionDefinition {
111  /// Used to mark options that can be used together. If
112  /// `(1 << n & usage_mask) != 0` then this option belongs to option set n.
113  uint32_t usage_mask;
114  /// This option is required (in the current usage level).
115  bool required;
116  /// Full name for this option.
117  const char *long_option;
118  /// Single character for this option.
119  int short_option;
120  /// no_argument, required_argument or optional_argument
121  int option_has_arg;
122  /// If non-NULL, option is valid iff |validator->IsValid()|, otherwise
123  /// always valid.
124  OptionValidator *validator;
125  /// If not empty, an array of enum values.
126  OptionEnumValues enum_values;
127  /// The kind of completion for this option.
128  /// Contains values of the CommandCompletions::CommonCompletionTypes enum.
129  uint32_t completion_type;
130  /// Type of argument this option takes.
131  lldb::CommandArgumentType argument_type;
132  /// Full text explaining what this options does and what (if any) argument to
133  /// pass it.
134  const char *usage_text;
135 };
136 
137 typedef struct type128 { uint64_t x[2]; } type128;
138 typedef struct type256 { uint64_t x[4]; } type256;
139 
140 } // namespace lldb_private
141 
142 #endif // #if defined(__cplusplus)
143 
144 #endif // LLDB_LLDB_PRIVATE_TYPES_H
A class that represents a running process on the host machine.
Definition: Debugger.h:49
Encoding
Register encoding definitions.
Format
Display format definitions.
static llvm::raw_ostream & error(Stream &strm)