lldb-private-enumerations.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. //===-- lldb-private-enumerations.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. #ifndef LLDB_LLDB_PRIVATE_ENUMERATIONS_H
  9. #define LLDB_LLDB_PRIVATE_ENUMERATIONS_H
  10. #include "llvm/ADT/StringRef.h"
  11. #include "llvm/Support/FormatProviders.h"
  12. #include "llvm/Support/raw_ostream.h"
  13. namespace lldb_private {
  14. // Thread Step Types
  15. enum StepType {
  16. eStepTypeNone,
  17. eStepTypeTrace, ///< Single step one instruction.
  18. eStepTypeTraceOver, ///< Single step one instruction, stepping over.
  19. eStepTypeInto, ///< Single step into a specified context.
  20. eStepTypeOver, ///< Single step over a specified context.
  21. eStepTypeOut, ///< Single step out a specified context.
  22. eStepTypeScripted ///< A step type implemented by the script interpreter.
  23. };
  24. // Address Types
  25. enum AddressType {
  26. eAddressTypeInvalid = 0,
  27. eAddressTypeFile, ///< Address is an address as found in an object or symbol
  28. /// file
  29. eAddressTypeLoad, ///< Address is an address as in the current target inferior
  30. /// process
  31. eAddressTypeHost ///< Address is an address in the process that is running
  32. /// this code
  33. };
  34. // Address Class
  35. //
  36. // A way of classifying an address used for disassembling and setting
  37. // breakpoints. Many object files can track exactly what parts of their object
  38. // files are code, data and other information. This is of course above and
  39. // beyond just looking at the section types. For example, code might contain PC
  40. // relative data and the object file might be able to tell us that an address
  41. // in code is data.
  42. enum class AddressClass {
  43. eInvalid,
  44. eUnknown,
  45. eCode,
  46. eCodeAlternateISA,
  47. eData,
  48. eDebug,
  49. eRuntime
  50. };
  51. // Votes - Need a tri-state, yes, no, no opinion...
  52. enum Vote { eVoteNo = -1, eVoteNoOpinion = 0, eVoteYes = 1 };
  53. enum ArchitectureType {
  54. eArchTypeInvalid,
  55. eArchTypeMachO,
  56. eArchTypeELF,
  57. eArchTypeCOFF,
  58. kNumArchTypes
  59. };
  60. /// Settable state variable types.
  61. ///
  62. // typedef enum SettableVariableType
  63. //{
  64. // eSetVarTypeInt,
  65. // eSetVarTypeBoolean,
  66. // eSetVarTypeString,
  67. // eSetVarTypeArray,
  68. // eSetVarTypeDictionary,
  69. // eSetVarTypeEnum,
  70. // eSetVarTypeNone
  71. //} SettableVariableType;
  72. enum VarSetOperationType {
  73. eVarSetOperationReplace,
  74. eVarSetOperationInsertBefore,
  75. eVarSetOperationInsertAfter,
  76. eVarSetOperationRemove,
  77. eVarSetOperationAppend,
  78. eVarSetOperationClear,
  79. eVarSetOperationAssign,
  80. eVarSetOperationInvalid
  81. };
  82. enum ArgumentRepetitionType {
  83. eArgRepeatPlain, // Exactly one occurrence
  84. eArgRepeatOptional, // At most one occurrence, but it's optional
  85. eArgRepeatPlus, // One or more occurrences
  86. eArgRepeatStar, // Zero or more occurrences
  87. eArgRepeatRange, // Repetition of same argument, from 1 to n
  88. eArgRepeatPairPlain, // A pair of arguments that must always go together
  89. // ([arg-type arg-value]), occurs exactly once
  90. eArgRepeatPairOptional, // A pair that occurs at most once (optional)
  91. eArgRepeatPairPlus, // One or more occurrences of a pair
  92. eArgRepeatPairStar, // Zero or more occurrences of a pair
  93. eArgRepeatPairRange, // A pair that repeats from 1 to n
  94. eArgRepeatPairRangeOptional // A pair that repeats from 1 to n, but is
  95. // optional
  96. };
  97. enum SortOrder { eSortOrderNone, eSortOrderByAddress, eSortOrderByName };
  98. // LazyBool is for boolean values that need to be calculated lazily. Values
  99. // start off set to eLazyBoolCalculate, and then they can be calculated once
  100. // and set to eLazyBoolNo or eLazyBoolYes.
  101. enum LazyBool { eLazyBoolCalculate = -1, eLazyBoolNo = 0, eLazyBoolYes = 1 };
  102. /// Instruction types
  103. enum InstructionType {
  104. eInstructionTypeAny, // Support for any instructions at all (at least one)
  105. eInstructionTypePrologueEpilogue, // All prologue and epilogue instructions
  106. // that push and pop register values and
  107. // modify sp/fp
  108. eInstructionTypePCModifying, // Any instruction that modifies the program
  109. // counter/instruction pointer
  110. eInstructionTypeAll // All instructions of any kind
  111. };
  112. /// Format category entry types
  113. enum FormatCategoryItem {
  114. eFormatCategoryItemSummary = 0x0001,
  115. eFormatCategoryItemRegexSummary = 0x0002,
  116. eFormatCategoryItemFilter = 0x0004,
  117. eFormatCategoryItemRegexFilter = 0x0008,
  118. eFormatCategoryItemSynth = 0x0010,
  119. eFormatCategoryItemRegexSynth = 0x0020,
  120. eFormatCategoryItemValue = 0x0040,
  121. eFormatCategoryItemRegexValue = 0x0080,
  122. eFormatCategoryItemValidator = 0x0100,
  123. eFormatCategoryItemRegexValidator = 0x0200
  124. };
  125. /// Expression execution policies
  126. enum ExecutionPolicy {
  127. eExecutionPolicyOnlyWhenNeeded,
  128. eExecutionPolicyNever,
  129. eExecutionPolicyAlways,
  130. eExecutionPolicyTopLevel // used for top-level code
  131. };
  132. // Synchronicity behavior of scripted commands
  133. enum ScriptedCommandSynchronicity {
  134. eScriptedCommandSynchronicitySynchronous,
  135. eScriptedCommandSynchronicityAsynchronous,
  136. eScriptedCommandSynchronicityCurrentValue // use whatever the current
  137. // synchronicity is
  138. };
  139. // Verbosity mode of "po" output
  140. enum LanguageRuntimeDescriptionDisplayVerbosity {
  141. eLanguageRuntimeDescriptionDisplayVerbosityCompact, // only print the
  142. // description string, if
  143. // any
  144. eLanguageRuntimeDescriptionDisplayVerbosityFull, // print the full-blown
  145. // output
  146. };
  147. // Loading modules from memory
  148. enum MemoryModuleLoadLevel {
  149. eMemoryModuleLoadLevelMinimal, // Load sections only
  150. eMemoryModuleLoadLevelPartial, // Load function bounds but no symbols
  151. eMemoryModuleLoadLevelComplete, // Load sections and all symbols
  152. };
  153. // Result enums for when reading multiple lines from IOHandlers
  154. enum class LineStatus {
  155. Success, // The line that was just edited if good and should be added to the
  156. // lines
  157. Status, // There is an error with the current line and it needs to be
  158. // re-edited
  159. // before it can be accepted
  160. Done // Lines are complete
  161. };
  162. // Boolean result of running a Type Validator
  163. enum class TypeValidatorResult : bool { Success = true, Failure = false };
  164. // Enumerations that can be used to specify scopes types when looking up types.
  165. enum class CompilerContextKind : uint16_t {
  166. Invalid = 0,
  167. TranslationUnit = 1,
  168. Module = 1 << 1,
  169. Namespace = 1 << 2,
  170. Class = 1 << 3,
  171. Struct = 1 << 4,
  172. Union = 1 << 5,
  173. Function = 1 << 6,
  174. Variable = 1 << 7,
  175. Enum = 1 << 8,
  176. Typedef = 1 << 9,
  177. Any = 1 << 15,
  178. /// Match 0..n nested modules.
  179. AnyModule = Any | Module,
  180. /// Match any type.
  181. AnyType = Any | Class | Struct | Union | Enum | Typedef
  182. };
  183. // Enumerations that can be used to specify the kind of metric we're looking at
  184. // when collecting stats.
  185. enum StatisticKind {
  186. ExpressionSuccessful = 0,
  187. ExpressionFailure = 1,
  188. FrameVarSuccess = 2,
  189. FrameVarFailure = 3,
  190. StatisticMax = 4
  191. };
  192. inline std::string GetStatDescription(lldb_private::StatisticKind K) {
  193. switch (K) {
  194. case StatisticKind::ExpressionSuccessful:
  195. return "Number of expr evaluation successes";
  196. case StatisticKind::ExpressionFailure:
  197. return "Number of expr evaluation failures";
  198. case StatisticKind::FrameVarSuccess:
  199. return "Number of frame var successes";
  200. case StatisticKind::FrameVarFailure:
  201. return "Number of frame var failures";
  202. case StatisticKind::StatisticMax:
  203. return "";
  204. }
  205. llvm_unreachable("Statistic not registered!");
  206. }
  207. } // namespace lldb_private
  208. namespace llvm {
  209. template <> struct format_provider<lldb_private::Vote> {
  210. static void format(const lldb_private::Vote &V, llvm::raw_ostream &Stream,
  211. StringRef Style) {
  212. switch (V) {
  213. case lldb_private::eVoteNo:
  214. Stream << "no";
  215. return;
  216. case lldb_private::eVoteNoOpinion:
  217. Stream << "no opinion";
  218. return;
  219. case lldb_private::eVoteYes:
  220. Stream << "yes";
  221. return;
  222. }
  223. Stream << "invalid";
  224. }
  225. };
  226. }
  227. #endif // LLDB_LLDB_PRIVATE_ENUMERATIONS_H