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