• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
50   uint32_t kinds[lldb::kNumRegisterKinds]; //
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 
dataRegisterInfo68   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 
mutable_dataRegisterInfo72   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 {
~OptionValidatorOptionValidator103   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 typedef struct type128 { uint64_t x[2]; } type128;
111 typedef struct type256 { uint64_t x[4]; } type256;
112 
113 } // namespace lldb_private
114 
115 #endif // #if defined(__cplusplus)
116 
117 #endif // LLDB_LLDB_PRIVATE_TYPES_H
118