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