/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/lldb-private-types.h
Line | Count | Source (jump to first uncovered line) |
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 | | #include "lldb/lldb-private.h" |
13 | | |
14 | | #include "llvm/ADT/ArrayRef.h" |
15 | | |
16 | | #include <type_traits> |
17 | | |
18 | | namespace llvm { |
19 | | namespace sys { |
20 | | class DynamicLibrary; |
21 | | } |
22 | | } |
23 | | |
24 | | namespace lldb_private { |
25 | | class Platform; |
26 | | class ExecutionContext; |
27 | | class RegisterFlags; |
28 | | |
29 | | typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType)( |
30 | | const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Status &error); |
31 | | |
32 | | /// Every register is described in detail including its name, alternate name |
33 | | /// (optional), encoding, size in bytes and the default display format. |
34 | | struct RegisterInfo { |
35 | | /// Name of this register, can't be NULL. |
36 | | const char *name; |
37 | | /// Alternate name of this register, can be NULL. |
38 | | const char *alt_name; |
39 | | /// Size in bytes of the register. |
40 | | uint32_t byte_size; |
41 | | /// The byte offset in the register context data where this register's |
42 | | /// value is found. |
43 | | /// This is optional, and can be 0 if a particular RegisterContext does not |
44 | | /// need to address its registers by byte offset. |
45 | | uint32_t byte_offset; |
46 | | /// Encoding of the register bits. |
47 | | lldb::Encoding encoding; |
48 | | /// Default display format. |
49 | | lldb::Format format; |
50 | | /// Holds all of the various register numbers for all register kinds. |
51 | | uint32_t kinds[lldb::kNumRegisterKinds]; // |
52 | | /// List of registers (terminated with LLDB_INVALID_REGNUM). If this value is |
53 | | /// not null, all registers in this list will be read first, at which point |
54 | | /// the value for this register will be valid. For example, the value list |
55 | | /// for ah would be eax (x86) or rax (x64). Register numbers are |
56 | | /// of eRegisterKindLLDB. If multiple registers are listed, the final |
57 | | /// value will be the concatenation of them. |
58 | | uint32_t *value_regs; |
59 | | /// List of registers (terminated with LLDB_INVALID_REGNUM). If this value is |
60 | | /// not null, all registers in this list will be invalidated when the value of |
61 | | /// this register changes. For example, the invalidate list for eax would be |
62 | | /// rax ax, ah, and al. |
63 | | uint32_t *invalidate_regs; |
64 | | /// If not nullptr, a type defined by XML descriptions. |
65 | | const RegisterFlags *flags_type; |
66 | | |
67 | 0 | llvm::ArrayRef<uint8_t> data(const uint8_t *context_base) const { |
68 | 0 | return llvm::ArrayRef<uint8_t>(context_base + byte_offset, byte_size); |
69 | 0 | } |
70 | | |
71 | 596 | llvm::MutableArrayRef<uint8_t> mutable_data(uint8_t *context_base) const { |
72 | 596 | return llvm::MutableArrayRef<uint8_t>(context_base + byte_offset, |
73 | 596 | byte_size); |
74 | 596 | } |
75 | | }; |
76 | | static_assert(std::is_trivial<RegisterInfo>::value, |
77 | | "RegisterInfo must be trivial."); |
78 | | |
79 | | /// Registers are grouped into register sets |
80 | | struct RegisterSet { |
81 | | /// Name of this register set. |
82 | | const char *name; |
83 | | /// A short name for this register set. |
84 | | const char *short_name; |
85 | | /// The number of registers in REGISTERS array below. |
86 | | size_t num_registers; |
87 | | /// An array of register indices in this set. The values in this array are |
88 | | /// *indices* (not register numbers) into a particular RegisterContext's |
89 | | /// register array. For example, if eax is defined at index 4 for a |
90 | | /// particular RegisterContext, eax would be included in this RegisterSet by |
91 | | /// adding the value 4. Not by adding the value lldb_eax_i386. |
92 | | const uint32_t *registers; |
93 | | }; |
94 | | |
95 | | struct OptionEnumValueElement { |
96 | | int64_t value; |
97 | | const char *string_value; |
98 | | const char *usage; |
99 | | }; |
100 | | |
101 | | using OptionEnumValues = llvm::ArrayRef<OptionEnumValueElement>; |
102 | | |
103 | | struct OptionValidator { |
104 | 0 | virtual ~OptionValidator() = default; |
105 | | virtual bool IsValid(Platform &platform, |
106 | | const ExecutionContext &target) const = 0; |
107 | | virtual const char *ShortConditionString() const = 0; |
108 | | virtual const char *LongConditionString() const = 0; |
109 | | }; |
110 | | |
111 | | typedef struct type128 { uint64_t x[2]; } type128; |
112 | | typedef struct type256 { uint64_t x[4]; } type256; |
113 | | |
114 | | /// Functor that returns a ValueObjectSP for a variable given its name |
115 | | /// and the StackFrame of interest. Used primarily in the Materializer |
116 | | /// to refetch a ValueObject when the ExecutionContextScope changes. |
117 | | using ValueObjectProviderTy = |
118 | | std::function<lldb::ValueObjectSP(ConstString, StackFrame *)>; |
119 | | |
120 | | typedef void (*DebuggerDestroyCallback)(lldb::user_id_t debugger_id, |
121 | | void *baton); |
122 | | typedef bool (*CommandOverrideCallbackWithResult)( |
123 | | void *baton, const char **argv, lldb_private::CommandReturnObject &result); |
124 | | } // namespace lldb_private |
125 | | |
126 | | #endif // LLDB_LLDB_PRIVATE_TYPES_H |