Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:00

0001 //===-- lldb-private-types.h ------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_LLDB_PRIVATE_TYPES_H
0010 #define LLDB_LLDB_PRIVATE_TYPES_H
0011 
0012 #include "lldb/lldb-private.h"
0013 
0014 #include "llvm/ADT/ArrayRef.h"
0015 #include "llvm/ADT/SmallString.h"
0016 
0017 #include <type_traits>
0018 
0019 namespace llvm {
0020 namespace sys {
0021 class DynamicLibrary;
0022 }
0023 }
0024 
0025 namespace lldb_private {
0026 class Platform;
0027 class ExecutionContext;
0028 class RegisterFlags;
0029 
0030 typedef llvm::SmallString<256> PathSmallString;
0031 
0032 typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType)(
0033     const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Status &error);
0034 
0035 /// Every register is described in detail including its name, alternate name
0036 /// (optional), encoding, size in bytes and the default display format.
0037 struct RegisterInfo {
0038   /// Name of this register, can't be NULL.
0039   const char *name;
0040   /// Alternate name of this register, can be NULL.
0041   const char *alt_name;
0042   /// Size in bytes of the register.
0043   uint32_t byte_size;
0044   /// The byte offset in the register context data where this register's
0045   /// value is found.
0046   /// This is optional, and can be 0 if a particular RegisterContext does not
0047   /// need to address its registers by byte offset.
0048   uint32_t byte_offset;
0049   /// Encoding of the register bits.
0050   lldb::Encoding encoding;
0051   /// Default display format.
0052   lldb::Format format;
0053   /// Holds all of the various register numbers for all register kinds.
0054   uint32_t kinds[lldb::kNumRegisterKinds]; //
0055   /// List of registers (terminated with LLDB_INVALID_REGNUM). If this value is
0056   /// not null, all registers in this list will be read first, at which point
0057   /// the value for this register will be valid. For example, the value list
0058   /// for ah would be eax (x86) or rax (x64). Register numbers are
0059   /// of eRegisterKindLLDB. If multiple registers are listed, the final
0060   /// value will be the concatenation of them.
0061   uint32_t *value_regs;
0062   /// List of registers (terminated with LLDB_INVALID_REGNUM). If this value is
0063   /// not null, all registers in this list will be invalidated when the value of
0064   /// this register changes. For example, the invalidate list for eax would be
0065   /// rax ax, ah, and al.
0066   uint32_t *invalidate_regs;
0067   /// If not nullptr, a type defined by XML descriptions.
0068   /// Register info tables are constructed as const, but this field may need to
0069   /// be updated if a specific target OS has a different layout. To enable that,
0070   /// this is mutable. The data pointed to is still const, so you must swap a
0071   /// whole set of flags for another.
0072   mutable const RegisterFlags *flags_type;
0073 
0074   llvm::ArrayRef<uint8_t> data(const uint8_t *context_base) const {
0075     return llvm::ArrayRef<uint8_t>(context_base + byte_offset, byte_size);
0076   }
0077 
0078   llvm::MutableArrayRef<uint8_t> mutable_data(uint8_t *context_base) const {
0079     return llvm::MutableArrayRef<uint8_t>(context_base + byte_offset,
0080                                           byte_size);
0081   }
0082 };
0083 static_assert(std::is_trivial<RegisterInfo>::value,
0084               "RegisterInfo must be trivial.");
0085 
0086 /// Registers are grouped into register sets
0087 struct RegisterSet {
0088   /// Name of this register set.
0089   const char *name;
0090   /// A short name for this register set.
0091   const char *short_name;
0092   /// The number of registers in REGISTERS array below.
0093   size_t num_registers;
0094   /// An array of register indices in this set. The values in this array are
0095   /// *indices* (not register numbers) into a particular RegisterContext's
0096   /// register array.  For example, if eax is defined at index 4 for a
0097   /// particular RegisterContext, eax would be included in this RegisterSet by
0098   /// adding the value 4.  Not by adding the value lldb_eax_i386.
0099   const uint32_t *registers;
0100 };
0101 
0102 /// A type-erased pair of llvm::dwarf::SourceLanguageName and version.
0103 struct SourceLanguage {
0104   SourceLanguage() = default;
0105   SourceLanguage(lldb::LanguageType language_type);
0106   SourceLanguage(uint16_t name, uint32_t version)
0107       : name(name), version(version) {}
0108   SourceLanguage(std::optional<std::pair<uint16_t, uint32_t>> name_vers)
0109       : name(name_vers ? name_vers->first : 0),
0110         version(name_vers ? name_vers->second : 0) {}
0111   operator bool() const { return name > 0; }
0112   lldb::LanguageType AsLanguageType() const;
0113   llvm::StringRef GetDescription() const;
0114   bool IsC() const;
0115   bool IsObjC() const;
0116   bool IsCPlusPlus() const;
0117   uint16_t name = 0;
0118   uint32_t version = 0;
0119 };
0120 
0121 struct OptionEnumValueElement {
0122   int64_t value;
0123   const char *string_value;
0124   const char *usage;
0125 };
0126 
0127 using OptionEnumValues = llvm::ArrayRef<OptionEnumValueElement>;
0128 
0129 struct OptionValidator {
0130   virtual ~OptionValidator() = default;
0131   virtual bool IsValid(Platform &platform,
0132                        const ExecutionContext &target) const = 0;
0133   virtual const char *ShortConditionString() const = 0;
0134   virtual const char *LongConditionString() const = 0;
0135 };
0136 
0137 typedef struct type128 { uint64_t x[2]; } type128;
0138 typedef struct type256 { uint64_t x[4]; } type256;
0139 
0140 /// Functor that returns a ValueObjectSP for a variable given its name
0141 /// and the StackFrame of interest. Used primarily in the Materializer
0142 /// to refetch a ValueObject when the ExecutionContextScope changes.
0143 using ValueObjectProviderTy =
0144     std::function<lldb::ValueObjectSP(ConstString, StackFrame *)>;
0145 
0146 typedef void (*DebuggerDestroyCallback)(lldb::user_id_t debugger_id,
0147                                         void *baton);
0148 typedef bool (*CommandOverrideCallbackWithResult)(
0149     void *baton, const char **argv, lldb_private::CommandReturnObject &result);
0150 } // namespace lldb_private
0151 
0152 #endif // LLDB_LLDB_PRIVATE_TYPES_H