1 //===-- lldb-private-types.h ------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef liblldb_lldb_private_types_h_ 11 #define liblldb_lldb_private_types_h_ 12 13 #if defined(__cplusplus) 14 15 #include "lldb/lldb-private.h" 16 17 namespace llvm 18 { 19 namespace sys 20 { 21 class DynamicLibrary; 22 } 23 } 24 25 namespace lldb_private 26 { 27 class Platform; 28 class ExecutionContext; 29 30 typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType)(const lldb::DebuggerSP &debugger_sp, 31 const FileSpec &spec, Error &error); 32 33 //---------------------------------------------------------------------- 34 // Every register is described in detail including its name, alternate 35 // name (optional), encoding, size in bytes and the default display 36 // format. 37 //---------------------------------------------------------------------- 38 typedef struct 39 { 40 const char *name; // Name of this register, can't be NULL 41 const char *alt_name; // Alternate name of this register, can be NULL 42 uint32_t byte_size; // Size in bytes of the register 43 uint32_t byte_offset; // The byte offset in the register context data where this register's value is found. 44 // This is optional, and can be 0 if a particular RegisterContext does not need to 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 numbers for all register kinds 49 uint32_t *value_regs; // List of registers (terminated with LLDB_INVALID_REGNUM). If this value is not 50 // null, all registers in this list will be read first, at which point the value 51 // for this register will be valid. For example, the value list for ah 52 // would be eax (x86) or rax (x64). 53 uint32_t *invalidate_regs; // List of registers (terminated with LLDB_INVALID_REGNUM). If this value is not 54 // null, all registers in this list will be invalidateed when the value of this 55 // register changes. For example, the invalidate list for eax would be rax 56 // ax, ah, and al. 57 } RegisterInfo; 58 59 //---------------------------------------------------------------------- 60 // Registers are grouped into register sets 61 //---------------------------------------------------------------------- 62 typedef struct 63 { 64 const char *name; // Name of this register set 65 const char *short_name; // A short name for this register set 66 size_t num_registers; // The number of registers in REGISTERS array below 67 const uint32_t *registers; // An array of register indices in this set. The values in this array are 68 // *indices* (not register numbers) into a particular RegisterContext's 69 // register array. For example, if eax is defined at index 4 for a 70 // particular RegisterContext, eax would be included in this RegisterSet 71 // by adding the value 4. Not by adding the value lldb_eax_i386. 72 } RegisterSet; 73 74 typedef struct 75 { 76 int64_t value; 77 const char *string_value; 78 const char *usage; 79 } OptionEnumValueElement; 80 81 struct OptionValidator 82 { ~OptionValidatorOptionValidator83 virtual ~OptionValidator() { } 84 virtual bool IsValid(Platform &platform, const ExecutionContext &target) const = 0; 85 virtual const char * ShortConditionString() const = 0; 86 virtual const char * LongConditionString() const = 0; 87 }; 88 89 struct OptionDefinition 90 { 91 uint32_t usage_mask; // Used to mark options that can be used together. If (1 << n & usage_mask) != 0 92 // then this option belongs to option set n. 93 bool required; // This option is required (in the current usage level) 94 const char *long_option; // Full name for this option. 95 int short_option; // Single character for this option. 96 int option_has_arg; // no_argument, required_argument or optional_argument 97 OptionValidator* validator; // If non-NULL, option is valid iff |validator->IsValid()|, otherwise always valid. 98 OptionEnumValueElement *enum_values; // If non-NULL an array of enum values. 99 uint32_t completion_type; // Cookie the option class can use to do define the argument completion. 100 lldb::CommandArgumentType argument_type; // Type of argument this option takes 101 const char *usage_text; // Full text explaining what this options does and what (if any) argument to 102 // pass it. 103 }; 104 105 } // namespace lldb_private 106 107 #endif // #if defined(__cplusplus) 108 109 #endif // liblldb_lldb_private_types_h_ 110