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

source code of lldb/include/lldb/lldb-private-enumerations.h