1254721Semaste//===-- lldb-private-enumerations.h -----------------------------*- C++ -*-===//
2254721Semaste//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6254721Semaste//
7254721Semaste//===----------------------------------------------------------------------===//
8254721Semaste
9254721Semaste#ifndef LLDB_lldb_private_enumerations_h_
10254721Semaste#define LLDB_lldb_private_enumerations_h_
11254721Semaste
12321369Sdim#include "llvm/ADT/StringRef.h"
13321369Sdim#include "llvm/Support/FormatProviders.h"
14321369Sdim#include "llvm/Support/raw_ostream.h"
15321369Sdim
16254721Semastenamespace lldb_private {
17254721Semaste
18254721Semaste// Thread Step Types
19353358Sdimenum StepType {
20314564Sdim  eStepTypeNone,
21314564Sdim  eStepTypeTrace,     ///< Single step one instruction.
22314564Sdim  eStepTypeTraceOver, ///< Single step one instruction, stepping over.
23314564Sdim  eStepTypeInto,      ///< Single step into a specified context.
24314564Sdim  eStepTypeOver,      ///< Single step over a specified context.
25314564Sdim  eStepTypeOut,       ///< Single step out a specified context.
26314564Sdim  eStepTypeScripted   ///< A step type implemented by the script interpreter.
27353358Sdim};
28254721Semaste
29254721Semaste// Address Types
30353358Sdimenum AddressType {
31314564Sdim  eAddressTypeInvalid = 0,
32314564Sdim  eAddressTypeFile, ///< Address is an address as found in an object or symbol
33353358Sdim                    /// file
34314564Sdim  eAddressTypeLoad, ///< Address is an address as in the current target inferior
35353358Sdim                    /// process
36314564Sdim  eAddressTypeHost  ///< Address is an address in the process that is running
37353358Sdim                    /// this code
38353358Sdim};
39254721Semaste
40341825Sdim// Address Class
41341825Sdim//
42341825Sdim// A way of classifying an address used for disassembling and setting
43341825Sdim// breakpoints. Many object files can track exactly what parts of their object
44341825Sdim// files are code, data and other information. This is of course above and
45341825Sdim// beyond just looking at the section types. For example, code might contain PC
46341825Sdim// relative data and the object file might be able to tell us that an address
47341825Sdim// in code is data.
48341825Sdimenum class AddressClass {
49341825Sdim  eInvalid,
50341825Sdim  eUnknown,
51341825Sdim  eCode,
52341825Sdim  eCodeAlternateISA,
53341825Sdim  eData,
54341825Sdim  eDebug,
55341825Sdim  eRuntime
56341825Sdim};
57341825Sdim
58254721Semaste// Votes - Need a tri-state, yes, no, no opinion...
59353358Sdimenum Vote { eVoteNo = -1, eVoteNoOpinion = 0, eVoteYes = 1 };
60254721Semaste
61353358Sdimenum ArchitectureType {
62314564Sdim  eArchTypeInvalid,
63314564Sdim  eArchTypeMachO,
64314564Sdim  eArchTypeELF,
65314564Sdim  eArchTypeCOFF,
66314564Sdim  kNumArchTypes
67353358Sdim};
68254721Semaste
69254721Semaste/// Settable state variable types.
70254721Semaste///
71254721Semaste
72314564Sdim// typedef enum SettableVariableType
73254721Semaste//{
74254721Semaste//    eSetVarTypeInt,
75254721Semaste//    eSetVarTypeBoolean,
76254721Semaste//    eSetVarTypeString,
77254721Semaste//    eSetVarTypeArray,
78254721Semaste//    eSetVarTypeDictionary,
79254721Semaste//    eSetVarTypeEnum,
80254721Semaste//    eSetVarTypeNone
81254721Semaste//} SettableVariableType;
82254721Semaste
83353358Sdimenum VarSetOperationType {
84314564Sdim  eVarSetOperationReplace,
85314564Sdim  eVarSetOperationInsertBefore,
86314564Sdim  eVarSetOperationInsertAfter,
87314564Sdim  eVarSetOperationRemove,
88314564Sdim  eVarSetOperationAppend,
89314564Sdim  eVarSetOperationClear,
90314564Sdim  eVarSetOperationAssign,
91314564Sdim  eVarSetOperationInvalid
92353358Sdim};
93254721Semaste
94353358Sdimenum ArgumentRepetitionType {
95314564Sdim  eArgRepeatPlain,        // Exactly one occurrence
96314564Sdim  eArgRepeatOptional,     // At most one occurrence, but it's optional
97314564Sdim  eArgRepeatPlus,         // One or more occurrences
98314564Sdim  eArgRepeatStar,         // Zero or more occurrences
99314564Sdim  eArgRepeatRange,        // Repetition of same argument, from 1 to n
100314564Sdim  eArgRepeatPairPlain,    // A pair of arguments that must always go together
101314564Sdim                          // ([arg-type arg-value]), occurs exactly once
102314564Sdim  eArgRepeatPairOptional, // A pair that occurs at most once (optional)
103314564Sdim  eArgRepeatPairPlus,     // One or more occurrences of a pair
104314564Sdim  eArgRepeatPairStar,     // Zero or more occurrences of a pair
105314564Sdim  eArgRepeatPairRange,    // A pair that repeats from 1 to n
106314564Sdim  eArgRepeatPairRangeOptional // A pair that repeats from 1 to n, but is
107314564Sdim                              // optional
108353358Sdim};
109254721Semaste
110353358Sdimenum SortOrder { eSortOrderNone, eSortOrderByAddress, eSortOrderByName };
111254721Semaste
112341825Sdim// LazyBool is for boolean values that need to be calculated lazily. Values
113341825Sdim// start off set to eLazyBoolCalculate, and then they can be calculated once
114341825Sdim// and set to eLazyBoolNo or eLazyBoolYes.
115353358Sdimenum LazyBool { eLazyBoolCalculate = -1, eLazyBoolNo = 0, eLazyBoolYes = 1 };
116254721Semaste
117254721Semaste/// Instruction types
118353358Sdimenum InstructionType {
119314564Sdim  eInstructionTypeAny, // Support for any instructions at all (at least one)
120314564Sdim  eInstructionTypePrologueEpilogue, // All prologue and epilogue instructions
121314564Sdim                                    // that push and pop register values and
122314564Sdim                                    // modify sp/fp
123314564Sdim  eInstructionTypePCModifying,      // Any instruction that modifies the program
124314564Sdim                                    // counter/instruction pointer
125314564Sdim  eInstructionTypeAll               // All instructions of any kind
126254721Semaste
127353358Sdim};
128314564Sdim
129254721Semaste/// Format category entry types
130353358Sdimenum FormatCategoryItem {
131314564Sdim  eFormatCategoryItemSummary = 0x0001,
132314564Sdim  eFormatCategoryItemRegexSummary = 0x0002,
133314564Sdim  eFormatCategoryItemFilter = 0x0004,
134314564Sdim  eFormatCategoryItemRegexFilter = 0x0008,
135314564Sdim  eFormatCategoryItemSynth = 0x0010,
136314564Sdim  eFormatCategoryItemRegexSynth = 0x0020,
137314564Sdim  eFormatCategoryItemValue = 0x0040,
138314564Sdim  eFormatCategoryItemRegexValue = 0x0080,
139314564Sdim  eFormatCategoryItemValidator = 0x0100,
140314564Sdim  eFormatCategoryItemRegexValidator = 0x0200
141353358Sdim};
142254721Semaste
143254721Semaste/// Expression execution policies
144353358Sdimenum ExecutionPolicy {
145314564Sdim  eExecutionPolicyOnlyWhenNeeded,
146314564Sdim  eExecutionPolicyNever,
147314564Sdim  eExecutionPolicyAlways,
148314564Sdim  eExecutionPolicyTopLevel // used for top-level code
149353358Sdim};
150254721Semaste
151254721Semaste// Ways that the FormatManager picks a particular format for a type
152353358Sdimenum FormatterChoiceCriterion {
153314564Sdim  eFormatterChoiceCriterionDirectChoice = 0x00000000,
154314564Sdim  eFormatterChoiceCriterionStrippedPointerReference = 0x00000001,
155314564Sdim  eFormatterChoiceCriterionNavigatedTypedefs = 0x00000002,
156314564Sdim  eFormatterChoiceCriterionRegularExpressionSummary = 0x00000004,
157314564Sdim  eFormatterChoiceCriterionRegularExpressionFilter = 0x00000004,
158314564Sdim  eFormatterChoiceCriterionLanguagePlugin = 0x00000008,
159314564Sdim  eFormatterChoiceCriterionStrippedBitField = 0x00000010,
160314564Sdim  eFormatterChoiceCriterionWentToStaticValue = 0x00000020
161353358Sdim};
162254721Semaste
163254721Semaste// Synchronicity behavior of scripted commands
164353358Sdimenum ScriptedCommandSynchronicity {
165314564Sdim  eScriptedCommandSynchronicitySynchronous,
166314564Sdim  eScriptedCommandSynchronicityAsynchronous,
167314564Sdim  eScriptedCommandSynchronicityCurrentValue // use whatever the current
168314564Sdim                                            // synchronicity is
169353358Sdim};
170254721Semaste
171258054Semaste// Verbosity mode of "po" output
172353358Sdimenum LanguageRuntimeDescriptionDisplayVerbosity {
173314564Sdim  eLanguageRuntimeDescriptionDisplayVerbosityCompact, // only print the
174314564Sdim                                                      // description string, if
175314564Sdim                                                      // any
176314564Sdim  eLanguageRuntimeDescriptionDisplayVerbosityFull,    // print the full-blown
177314564Sdim                                                      // output
178353358Sdim};
179254721Semaste
180254721Semaste// Loading modules from memory
181353358Sdimenum MemoryModuleLoadLevel {
182314564Sdim  eMemoryModuleLoadLevelMinimal,  // Load sections only
183314564Sdim  eMemoryModuleLoadLevelPartial,  // Load function bounds but no symbols
184314564Sdim  eMemoryModuleLoadLevelComplete, // Load sections and all symbols
185353358Sdim};
186254721Semaste
187262528Semaste// Result enums for when reading multiple lines from IOHandlers
188262528Semasteenum class LineStatus {
189314564Sdim  Success, // The line that was just edited if good and should be added to the
190314564Sdim           // lines
191321369Sdim  Status,  // There is an error with the current line and it needs to be
192321369Sdim           // re-edited
193321369Sdim           // before it can be accepted
194321369Sdim  Done     // Lines are complete
195262528Semaste};
196262528Semaste
197280031Sdim// Boolean result of running a Type Validator
198314564Sdimenum class TypeValidatorResult : bool { Success = true, Failure = false };
199296417Sdim
200341825Sdim// Enumerations that can be used to specify scopes types when looking up types.
201360784Sdimenum class CompilerContextKind : uint16_t {
202314564Sdim  Invalid = 0,
203360784Sdim  TranslationUnit = 1,
204360784Sdim  Module = 1 << 1,
205360784Sdim  Namespace = 1 << 2,
206360784Sdim  Class = 1 << 3,
207360784Sdim  Struct = 1 << 4,
208360784Sdim  Union = 1 << 5,
209360784Sdim  Function = 1 << 6,
210360784Sdim  Variable = 1 << 7,
211360784Sdim  Enum = 1 << 8,
212360784Sdim  Typedef = 1 << 9,
213360784Sdim
214360784Sdim  Any = 1 << 15,
215360784Sdim  /// Match 0..n nested modules.
216360784Sdim  AnyModule = Any | Module,
217360784Sdim  /// Match any type.
218360784Sdim  AnyType = Any | Class | Struct | Union | Enum | Typedef
219296417Sdim};
220314564Sdim
221341825Sdim// Enumerations that can be used to specify the kind of metric we're looking at
222341825Sdim// when collecting stats.
223341825Sdimenum StatisticKind {
224341825Sdim  ExpressionSuccessful = 0,
225341825Sdim  ExpressionFailure = 1,
226341825Sdim  FrameVarSuccess = 2,
227341825Sdim  FrameVarFailure = 3,
228341825Sdim  StatisticMax = 4
229341825Sdim};
230341825Sdim
231341825Sdim
232341825Sdiminline std::string GetStatDescription(lldb_private::StatisticKind K) {
233341825Sdim   switch (K) {
234341825Sdim   case StatisticKind::ExpressionSuccessful:
235341825Sdim     return "Number of expr evaluation successes";
236341825Sdim   case StatisticKind::ExpressionFailure:
237341825Sdim     return "Number of expr evaluation failures";
238341825Sdim   case StatisticKind::FrameVarSuccess:
239341825Sdim     return "Number of frame var successes";
240341825Sdim   case StatisticKind::FrameVarFailure:
241341825Sdim     return "Number of frame var failures";
242341825Sdim   case StatisticKind::StatisticMax:
243341825Sdim     return "";
244341825Sdim   }
245341825Sdim   llvm_unreachable("Statistic not registered!");
246341825Sdim}
247341825Sdim
248254721Semaste} // namespace lldb_private
249254721Semaste
250321369Sdimnamespace llvm {
251321369Sdimtemplate <> struct format_provider<lldb_private::Vote> {
252321369Sdim  static void format(const lldb_private::Vote &V, llvm::raw_ostream &Stream,
253321369Sdim                     StringRef Style) {
254321369Sdim    switch (V) {
255321369Sdim    case lldb_private::eVoteNo:
256321369Sdim      Stream << "no";
257321369Sdim      return;
258321369Sdim    case lldb_private::eVoteNoOpinion:
259321369Sdim      Stream << "no opinion";
260321369Sdim      return;
261321369Sdim    case lldb_private::eVoteYes:
262321369Sdim      Stream << "yes";
263321369Sdim      return;
264321369Sdim    }
265321369Sdim    Stream << "invalid";
266321369Sdim  }
267321369Sdim};
268321369Sdim}
269321369Sdim
270314564Sdim#endif // LLDB_lldb_private_enumerations_h_
271