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#include "lldb/lldb-private.h"
13
14#include "llvm/ADT/ArrayRef.h"
15
16#include <type_traits>
17
18namespace llvm {
19namespace sys {
20class DynamicLibrary;
21}
22}
23
24namespace lldb_private {
25class Platform;
26class ExecutionContext;
27class RegisterFlags;
28
29typedef 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.
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.
48 /// Default display format.
50 /// Holds all of the various register numbers for all register kinds.
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 /// Register info tables are constructed as const, but this field may need to
66 /// be updated if a specific target OS has a different layout. To enable that,
67 /// this is mutable. The data pointed to is still const, so you must swap a
68 /// whole set of flags for another.
69 mutable const RegisterFlags *flags_type;
70
71 llvm::ArrayRef<uint8_t> data(const uint8_t *context_base) const {
72 return llvm::ArrayRef<uint8_t>(context_base + byte_offset, byte_size);
73 }
74
75 llvm::MutableArrayRef<uint8_t> mutable_data(uint8_t *context_base) const {
76 return llvm::MutableArrayRef<uint8_t>(context_base + byte_offset,
77 byte_size);
78 }
79};
80static_assert(std::is_trivial<RegisterInfo>::value,
81 "RegisterInfo must be trivial.");
82
83/// Registers are grouped into register sets
85 /// Name of this register set.
86 const char *name;
87 /// A short name for this register set.
88 const char *short_name;
89 /// The number of registers in REGISTERS array below.
91 /// An array of register indices in this set. The values in this array are
92 /// *indices* (not register numbers) into a particular RegisterContext's
93 /// register array. For example, if eax is defined at index 4 for a
94 /// particular RegisterContext, eax would be included in this RegisterSet by
95 /// adding the value 4. Not by adding the value lldb_eax_i386.
96 const uint32_t *registers;
97};
98
100 int64_t value;
101 const char *string_value;
102 const char *usage;
103};
104
105using OptionEnumValues = llvm::ArrayRef<OptionEnumValueElement>;
106
108 virtual ~OptionValidator() = default;
109 virtual bool IsValid(Platform &platform,
110 const ExecutionContext &target) const = 0;
111 virtual const char *ShortConditionString() const = 0;
112 virtual const char *LongConditionString() const = 0;
113};
114
115typedef struct type128 { uint64_t x[2]; } type128;
116typedef struct type256 { uint64_t x[4]; } type256;
117
118/// Functor that returns a ValueObjectSP for a variable given its name
119/// and the StackFrame of interest. Used primarily in the Materializer
120/// to refetch a ValueObject when the ExecutionContextScope changes.
122 std::function<lldb::ValueObjectSP(ConstString, StackFrame *)>;
123
124typedef void (*DebuggerDestroyCallback)(lldb::user_id_t debugger_id,
125 void *baton);
127 void *baton, const char **argv, lldb_private::CommandReturnObject &result);
128} // namespace lldb_private
129
130#endif // LLDB_LLDB_PRIVATE_TYPES_H
static llvm::raw_ostream & error(Stream &strm)
A uniqued constant string class.
Definition: ConstString.h:40
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A file utility class.
Definition: FileSpec.h:56
A plug-in interface definition class for debug platform that includes many platform abilities such as...
Definition: Platform.h:74
This base class provides an interface to stack frames.
Definition: StackFrame.h:42
An error handling class.
Definition: Status.h:44
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
void(* DebuggerDestroyCallback)(lldb::user_id_t debugger_id, void *baton)
std::function< lldb::ValueObjectSP(ConstString, StackFrame *)> ValueObjectProviderTy
Functor that returns a ValueObjectSP for a variable given its name and the StackFrame of interest.
bool(* CommandOverrideCallbackWithResult)(void *baton, const char **argv, lldb_private::CommandReturnObject &result)
llvm::sys::DynamicLibrary(* LoadPluginCallbackType)(const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Status &error)
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:472
Format
Display format definitions.
std::shared_ptr< lldb_private::Debugger > DebuggerSP
Definition: lldb-forward.h:331
Encoding
Register encoding definitions.
uint64_t user_id_t
Definition: lldb-types.h:80
@ kNumRegisterKinds
Definition: Debugger.h:53
virtual ~OptionValidator()=default
virtual const char * LongConditionString() const =0
virtual const char * ShortConditionString() const =0
virtual bool IsValid(Platform &platform, const ExecutionContext &target) const =0
Every register is described in detail including its name, alternate name (optional),...
llvm::MutableArrayRef< uint8_t > mutable_data(uint8_t *context_base) const
lldb::Encoding encoding
Encoding of the register bits.
const char * alt_name
Alternate name of this register, can be NULL.
uint32_t * value_regs
List of registers (terminated with LLDB_INVALID_REGNUM).
uint32_t byte_offset
The byte offset in the register context data where this register's value is found.
uint32_t byte_size
Size in bytes of the register.
uint32_t kinds[lldb::kNumRegisterKinds]
Holds all of the various register numbers for all register kinds.
const RegisterFlags * flags_type
If not nullptr, a type defined by XML descriptions.
llvm::ArrayRef< uint8_t > data(const uint8_t *context_base) const
const char * name
Name of this register, can't be NULL.
lldb::Format format
Default display format.
uint32_t * invalidate_regs
List of registers (terminated with LLDB_INVALID_REGNUM).
Registers are grouped into register sets.
size_t num_registers
The number of registers in REGISTERS array below.
const uint32_t * registers
An array of register indices in this set.
const char * name
Name of this register set.
const char * short_name
A short name for this register set.