1 //===-- lldb-private-types.h ------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_lldb_private_types_h_
11 #define liblldb_lldb_private_types_h_
13 #if defined(__cplusplus)
15 #include "lldb/lldb-private.h"
17 #include "llvm/ADT/ArrayRef.h"
25 namespace lldb_private {
27 class ExecutionContext;
29 typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType)(
30 const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Status &error);
32 //----------------------------------------------------------------------
33 // Every register is described in detail including its name, alternate
34 // name (optional), encoding, size in bytes and the default display
36 //----------------------------------------------------------------------
38 const char *name; // Name of this register, can't be NULL
39 const char *alt_name; // Alternate name of this register, can be NULL
40 uint32_t byte_size; // Size in bytes of the register
41 uint32_t byte_offset; // The byte offset in the register context data where
42 // this register's value is found.
43 // This is optional, and can be 0 if a particular RegisterContext does not
45 // address its registers by byte offset.
46 lldb::Encoding encoding; // Encoding of the register bits
47 lldb::Format format; // Default display format
48 uint32_t kinds[lldb::kNumRegisterKinds]; // Holds all of the various register
49 // numbers for all register kinds
50 uint32_t *value_regs; // List of registers (terminated with
51 // LLDB_INVALID_REGNUM). If this value is not
52 // null, all registers in this list will be read first, at which point the
54 // for this register will be valid. For example, the value list for ah
55 // would be eax (x86) or rax (x64).
56 uint32_t *invalidate_regs; // List of registers (terminated with
57 // LLDB_INVALID_REGNUM). If this value is not
58 // null, all registers in this list will be invalidated when the value of this
59 // register changes. For example, the invalidate list for eax would be rax
61 const uint8_t *dynamic_size_dwarf_expr_bytes; // A DWARF expression that when
63 // the byte size of this register.
64 size_t dynamic_size_dwarf_len; // The length of the DWARF expression in bytes
65 // in the dynamic_size_dwarf_expr_bytes member.
67 llvm::ArrayRef<uint8_t> data(const uint8_t *context_base) const {
68 return llvm::ArrayRef<uint8_t>(context_base + byte_offset, byte_size);
71 llvm::MutableArrayRef<uint8_t> mutable_data(uint8_t *context_base) const {
72 return llvm::MutableArrayRef<uint8_t>(context_base + byte_offset,
77 //----------------------------------------------------------------------
78 // Registers are grouped into register sets
79 //----------------------------------------------------------------------
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
89 // by adding the value 4. Not by adding the value lldb_eax_i386.
92 struct OptionEnumValueElement {
94 const char *string_value;
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;
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 valid.
116 OptionEnumValueElement *enum_values; // If non-NULL an array of enum values.
117 uint32_t completion_type; // Cookie the option class can use to do define the
118 // argument completion.
119 lldb::CommandArgumentType argument_type; // Type of argument this option takes
120 const char *usage_text; // Full text explaining what this options does and
121 // what (if any) argument to
125 typedef struct type128 { uint64_t x[2]; } type128;
126 typedef struct type256 { uint64_t x[4]; } type256;
128 } // namespace lldb_private
130 #endif // #if defined(__cplusplus)
132 #endif // liblldb_lldb_private_types_h_