lldb-enumerations.h revision e179a5840a49167964ca768a13c252c58c9cffcc
1//===-- lldb-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_enumerations_h_
11#define LLDB_enumerations_h_
12
13#if !defined (__APPLE__)
14
15#include <endian.h>
16
17#endif
18
19namespace lldb {
20
21//----------------------------------------------------------------------
22// Process and Thread States
23//----------------------------------------------------------------------
24typedef enum StateType
25{
26    eStateInvalid = 0,
27    eStateUnloaded,
28    eStateAttaching,
29    eStateLaunching,
30    eStateStopped,
31    eStateRunning,
32    eStateStepping,
33    eStateCrashed,
34    eStateDetached,
35    eStateExited,
36    eStateSuspended
37} StateType;
38
39//----------------------------------------------------------------------
40// Thread Step Types
41//----------------------------------------------------------------------
42typedef enum StepType
43{
44    eStepTypeNone,
45    eStepTypeTrace,     ///< Single step one instruction.
46    eStepTypeTraceOver, ///< Single step one instruction, stepping over.
47    eStepTypeInto,      ///< Single step into a specified context.
48    eStepTypeOver,      ///< Single step over a specified context.
49    eStepTypeOut        ///< Single step out a specified context.
50} StepType;
51
52//----------------------------------------------------------------------
53// Launch Flags
54//----------------------------------------------------------------------
55typedef enum LaunchFlags
56{
57    eLaunchFlagNone         = 0u,
58    eLaunchFlagDisableASLR  = (1u << 0),  ///< Disable Address Space Layout Randomization
59    eLaunchFlagDisableSTDIO = (1u << 1),  ///< Disable stdio for inferior process (e.g. for a GUI app)
60    eLaunchFlagLaunchInTTY  = (1u << 2)   ///< Launch the process in a new TTY if supported by the host
61} LaunchFlags;
62
63//----------------------------------------------------------------------
64// Thread Run Modes
65//----------------------------------------------------------------------
66typedef enum RunMode {
67    eOnlyThisThread,
68    eAllThreads,
69    eOnlyDuringStepping
70} RunMode;
71
72//----------------------------------------------------------------------
73// Address Types
74//----------------------------------------------------------------------
75typedef enum AddressType
76{
77    eAddressTypeInvalid = 0,
78    eAddressTypeFile, ///< Address is an address as found in an object or symbol file
79    eAddressTypeLoad, ///< Address is an address as in the current target inferior process
80    eAddressTypeHost  ///< Address is an address in the process that is running this code
81} AddressType;
82
83//----------------------------------------------------------------------
84// Byte ordering definitions
85//----------------------------------------------------------------------
86typedef enum ByteOrder
87{
88    eByteOrderInvalid   = 0,
89    eByteOrderLittle    = 1234,
90    eByteOrderBig       = 4321,
91    eByteOrderPDP       = 3412,
92
93#if defined (__APPLE__)
94
95// On Mac OS X there are preprocessor defines automatically defined
96// for the byte order that we can rely on.
97
98#if   defined (__LITTLE_ENDIAN__)
99    eByteOrderHost      = eByteOrderLittle
100#elif defined (__BIG_ENDIAN__)
101    eByteOrderHost      = eByteOrderBig
102#elif defined (__PDP_ENDIAN__)
103    eByteOrderHost      = eByteOrderPDP
104#else
105#error unable to detect endianness
106#endif
107
108#else
109
110// On linux we rely upon the defines in <endian.h>
111
112#if __BYTE_ORDER == __LITTLE_ENDIAN
113    eByteOrderHost      = eByteOrderLittle
114#elif __BYTE_ORDER == __BIG_ENDIAN
115    eByteOrderHost      = eByteOrderBig
116#elif __BYTE_ORDER == __PDP_ENDIAN
117    eByteOrderHost      = eByteOrderPDP
118#else
119#error unable to detect endianness
120#endif
121
122#endif
123
124} ByteOrder;
125
126//----------------------------------------------------------------------
127// Register encoding definitions
128//----------------------------------------------------------------------
129typedef enum Encoding
130{
131    eEncodingInvalid = 0,
132    eEncodingUint,               // unsigned integer
133    eEncodingSint,               // signed integer
134    eEncodingIEEE754,            // float
135    eEncodingVector              // vector registers
136} Encoding;
137
138//----------------------------------------------------------------------
139// Display format definitions
140//----------------------------------------------------------------------
141typedef enum Format
142{
143    eFormatDefault = 0,
144    eFormatInvalid = 0,
145    eFormatBoolean,
146    eFormatBinary,
147    eFormatBytes,
148    eFormatBytesWithASCII,
149    eFormatChar,
150    eFormatCharPrintable,   // Only printable characters, space if not printable
151    eFormatComplex,
152    eFormatCString,         // NULL terminated C strings
153    eFormatDecimal,
154    eFormatEnum,
155    eFormatHex,
156    eFormatFloat,
157    eFormatOctal,
158    eFormatOSType,      // OS character codes encoded into an integer 'PICT' 'text' etc...
159    eFormatUnicode16,
160    eFormatUnicode32,
161    eFormatUnsigned,
162    eFormatPointer,
163    eFormatVectorOfChar,
164    eFormatVectorOfSInt8,
165    eFormatVectorOfUInt8,
166    eFormatVectorOfSInt16,
167    eFormatVectorOfUInt16,
168    eFormatVectorOfSInt32,
169    eFormatVectorOfUInt32,
170    eFormatVectorOfSInt64,
171    eFormatVectorOfUInt64,
172    eFormatVectorOfFloat32,
173    eFormatVectorOfFloat64,
174    eFormatVectorOfUInt128
175
176} Format;
177
178//----------------------------------------------------------------------
179// Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls
180//----------------------------------------------------------------------
181typedef enum DescriptionLevel
182{
183    eDescriptionLevelBrief = 0,
184    eDescriptionLevelFull,
185    eDescriptionLevelVerbose,
186    kNumDescriptionLevels
187} DescriptionLevel;
188
189//----------------------------------------------------------------------
190// Script interpreter types
191//----------------------------------------------------------------------
192typedef enum ScriptLanguage
193{
194    eScriptLanguageNone,
195    eScriptLanguagePython,
196    eScriptLanguageDefault = eScriptLanguagePython
197} ScriptLanguage;
198
199//----------------------------------------------------------------------
200// Register numbering types
201//----------------------------------------------------------------------
202typedef enum RegisterKind
203{
204    eRegisterKindGCC = 0,    // the register numbers seen in eh_frame
205    eRegisterKindDWARF,      // the register numbers seen DWARF
206    eRegisterKindGeneric,    // insn ptr reg, stack ptr reg, etc not specific to any particular target
207    eRegisterKindGDB,        // the register numbers gdb uses (matches stabs numbers?)
208    eRegisterKindLLDB,       // lldb's internal register numbers
209    kNumRegisterKinds
210} RegisterKind;
211
212//----------------------------------------------------------------------
213// Thread stop reasons
214//----------------------------------------------------------------------
215typedef enum StopReason
216{
217    eStopReasonInvalid = 0,
218    eStopReasonNone,
219    eStopReasonTrace,
220    eStopReasonBreakpoint,
221    eStopReasonWatchpoint,
222    eStopReasonSignal,
223    eStopReasonException,
224    eStopReasonPlanComplete
225} StopReason;
226
227//----------------------------------------------------------------------
228// Votes - Need a tri-state, yes, no, no opinion...
229//----------------------------------------------------------------------
230typedef enum Vote
231{
232    eVoteNo         = -1,
233    eVoteNoOpinion  =  0,
234    eVoteYes        =  1
235} Vote;
236
237//----------------------------------------------------------------------
238// Symbol types
239//----------------------------------------------------------------------
240typedef enum SymbolType
241{
242    eSymbolTypeAny = 0,
243    eSymbolTypeInvalid = 0,
244    eSymbolTypeAbsolute,
245    eSymbolTypeExtern,
246    eSymbolTypeCode,
247    eSymbolTypeData,
248    eSymbolTypeTrampoline,
249    eSymbolTypeRuntime,
250    eSymbolTypeException,
251    eSymbolTypeSourceFile,
252    eSymbolTypeHeaderFile,
253    eSymbolTypeObjectFile,
254    eSymbolTypeCommonBlock,
255    eSymbolTypeBlock,
256    eSymbolTypeLocal,
257    eSymbolTypeParam,
258    eSymbolTypeVariable,
259    eSymbolTypeVariableType,
260    eSymbolTypeLineEntry,
261    eSymbolTypeLineHeader,
262    eSymbolTypeScopeBegin,
263    eSymbolTypeScopeEnd,
264    eSymbolTypeAdditional, // When symbols take more than one entry, the extra entries get this type
265    eSymbolTypeCompiler,
266    eSymbolTypeInstrumentation,
267    eSymbolTypeUndefined
268} SymbolType;
269
270
271//----------------------------------------------------------------------
272// Command Return Status Types
273//----------------------------------------------------------------------
274typedef enum ReturnStatus
275{
276    eReturnStatusInvalid,
277    eReturnStatusSuccessFinishNoResult,
278    eReturnStatusSuccessFinishResult,
279    eReturnStatusSuccessContinuingNoResult,
280    eReturnStatusSuccessContinuingResult,
281    eReturnStatusStarted,
282    eReturnStatusFailed,
283    eReturnStatusQuit
284} ReturnStatus;
285
286
287//----------------------------------------------------------------------
288// Connection Status Types
289//----------------------------------------------------------------------
290typedef enum ConnectionStatus
291{
292    eConnectionStatusSuccess,         // Success
293    eConnectionStatusEndOfFile,       // End-of-file encountered
294    eConnectionStatusError,           // Check GetError() for details
295    eConnectionStatusTimedOut,        // Request timed out
296    eConnectionStatusNoConnection,    // No connection
297    eConnectionStatusLostConnection   // Lost connection while connected to a valid connection
298} ConnectionStatus;
299
300
301typedef enum ErrorType
302{
303    eErrorTypeInvalid,
304    eErrorTypeGeneric,      ///< Generic errors that can be any value.
305    eErrorTypeMachKernel,   ///< Mach kernel error codes.
306    eErrorTypePOSIX         ///< POSIX error codes.
307} ErrorType;
308
309
310typedef enum ValueType
311{
312    eValueTypeInvalid           = 0,
313    eValueTypeVariableGlobal    = 1,    // globals variable
314    eValueTypeVariableStatic    = 2,    // static variable
315    eValueTypeVariableArgument  = 3,    // function argument variables
316    eValueTypeVariableLocal     = 4,    // function local variables
317    eValueTypeRegister          = 5,    // stack frame register value
318    eValueTypeRegisterSet       = 6,    // A collection of stack frame register values
319    eValueTypeConstResult       = 7,    // constant result variables
320} ValueType;
321
322//----------------------------------------------------------------------
323// Token size/granularities for Input Readers
324//----------------------------------------------------------------------
325
326typedef enum InputReaderGranularity
327{
328    eInputReaderGranularityInvalid = 0,
329    eInputReaderGranularityByte,
330    eInputReaderGranularityWord,
331    eInputReaderGranularityLine,
332    eInputReaderGranularityAll
333} InputReaderGranularity;
334
335//------------------------------------------------------------------
336/// These mask bits allow a common interface for queries that can
337/// limit the amount of information that gets parsed to only the
338/// information that is requested. These bits also can indicate what
339/// actually did get resolved during query function calls.
340///
341/// Each definition corresponds to a one of the member variables
342/// in this class, and requests that that item be resolved, or
343/// indicates that the member did get resolved.
344//------------------------------------------------------------------
345typedef enum SymbolContextItem
346{
347    eSymbolContextTarget     = (1 << 0), ///< Set when \a target is requested from a query, or was located in query results
348    eSymbolContextModule     = (1 << 1), ///< Set when \a module is requested from a query, or was located in query results
349    eSymbolContextCompUnit   = (1 << 2), ///< Set when \a comp_unit is requested from a query, or was located in query results
350    eSymbolContextFunction   = (1 << 3), ///< Set when \a function is requested from a query, or was located in query results
351    eSymbolContextBlock      = (1 << 4), ///< Set when the deepest \a block is requested from a query, or was located in query results
352    eSymbolContextLineEntry  = (1 << 5), ///< Set when \a line_entry is requested from a query, or was located in query results
353    eSymbolContextSymbol     = (1 << 6), ///< Set when \a symbol is requested from a query, or was located in query results
354    eSymbolContextEverything = ((eSymbolContextSymbol << 1) - 1)  ///< Indicates to try and lookup everything up during a query.
355} SymbolContextItem;
356
357typedef enum Permissions
358{
359    ePermissionsWritable = (1 << 0),
360    ePermissionsReadable = (1 << 1),
361    ePermissionsExecutable = (1 << 2)
362} Permissions;
363
364typedef enum SectionType
365{
366    eSectionTypeInvalid,
367    eSectionTypeCode,
368    eSectionTypeContainer,              // The section contains child sections
369    eSectionTypeData,
370    eSectionTypeDataCString,            // Inlined C string data
371    eSectionTypeDataCStringPointers,    // Pointers to C string data
372    eSectionTypeDataSymbolAddress,      // Address of a symbol in the symbol table
373    eSectionTypeData4,
374    eSectionTypeData8,
375    eSectionTypeData16,
376    eSectionTypeDataPointers,
377    eSectionTypeDebug,
378    eSectionTypeZeroFill,
379    eSectionTypeDataObjCMessageRefs,    // Pointer to function pointer + selector
380    eSectionTypeDataObjCCFStrings,      // Objective C const CFString/NSString objects
381    eSectionTypeDWARFDebugAbbrev,
382    eSectionTypeDWARFDebugAranges,
383    eSectionTypeDWARFDebugFrame,
384    eSectionTypeDWARFDebugInfo,
385    eSectionTypeDWARFDebugLine,
386    eSectionTypeDWARFDebugLoc,
387    eSectionTypeDWARFDebugMacInfo,
388    eSectionTypeDWARFDebugPubNames,
389    eSectionTypeDWARFDebugPubTypes,
390    eSectionTypeDWARFDebugRanges,
391    eSectionTypeDWARFDebugStr,
392    eSectionTypeEHFrame,
393    eSectionTypeOther
394
395} SectionType;
396
397
398typedef enum InputReaderAction
399{
400    eInputReaderActivate,   // reader is newly pushed onto the reader stack
401    eInputReaderReactivate, // reader is on top of the stack again after another reader was popped off
402    eInputReaderDeactivate, // another reader was pushed on the stack
403    eInputReaderGotToken,   // reader got one of its tokens (granularity)
404    eInputReaderInterrupt,  // reader received an interrupt signal (probably from a control-c)
405    eInputReaderEndOfFile,  // reader received an EOF char (probably from a control-d)
406    eInputReaderDone        // reader was just popped off the stack and is done
407} InputReaderAction;
408
409
410typedef enum ArchitectureType
411{
412    eArchTypeInvalid,
413    eArchTypeMachO,
414    eArchTypeELF,
415    kNumArchTypes
416} ArchitectureType;
417
418typedef enum FunctionNameType
419{
420    eFunctionNameTypeNone       = 0u,
421    eFunctionNameTypeAuto       = (1u << 1),    // Automatically figure out which FunctionNameType
422                                                // bits to set based on the function name.
423    eFunctionNameTypeFull       = (1u << 2),    // The function name.
424                                                // For C this is the same as just the name of the function
425                                                // For C++ this is the demangled version of the mangled name.
426                                                // For ObjC this is the full function signature with the + or
427                                                // - and the square brackets and the class and selector
428    eFunctionNameTypeBase       = (1u << 3),    // The function name only, no namespaces or arguments and no class
429                                                // methods or selectors will be searched.
430    eFunctionNameTypeMethod     = (1u << 4),    // Find function by method name (C++) with no namespace or arguments
431    eFunctionNameTypeSelector   = (1u << 5),    // Find function by selector name (ObjC) names
432} FunctionNameType;
433
434
435typedef enum BreakpointEventType
436{
437    eBreakpointEventTypeInvalidType         = (1u << 0),
438    eBreakpointEventTypeAdded               = (1u << 1),
439    eBreakpointEventTypeRemoved             = (1u << 2),
440    eBreakpointEventTypeLocationsAdded      = (1u << 3),
441    eBreakpointEventTypeLocationsRemoved    = (1u << 4),
442    eBreakpointEventTypeLocationsResolved   = (1u << 5)
443} BreakpointEventType;
444
445
446//----------------------------------------------------------------------
447/// Programming language type.
448///
449/// These enumerations use the same language enumerations as the DWARF
450/// specification for ease of use and consistency.
451//----------------------------------------------------------------------
452typedef enum LanguageType
453{
454    eLanguageTypeUnknown         = 0x0000,   ///< Unknown or invalid language value.
455    eLanguageTypeC89             = 0x0001,   ///< ISO C:1989.
456    eLanguageTypeC               = 0x0002,   ///< Non-standardized C, such as K&R.
457    eLanguageTypeAda83           = 0x0003,   ///< ISO Ada:1983.
458    eLanguageTypeC_plus_plus     = 0x0004,   ///< ISO C++:1998.
459    eLanguageTypeCobol74         = 0x0005,   ///< ISO Cobol:1974.
460    eLanguageTypeCobol85         = 0x0006,   ///< ISO Cobol:1985.
461    eLanguageTypeFortran77       = 0x0007,   ///< ISO Fortran 77.
462    eLanguageTypeFortran90       = 0x0008,   ///< ISO Fortran 90.
463    eLanguageTypePascal83        = 0x0009,   ///< ISO Pascal:1983.
464    eLanguageTypeModula2         = 0x000a,   ///< ISO Modula-2:1996.
465    eLanguageTypeJava            = 0x000b,   ///< Java.
466    eLanguageTypeC99             = 0x000c,   ///< ISO C:1999.
467    eLanguageTypeAda95           = 0x000d,   ///< ISO Ada:1995.
468    eLanguageTypeFortran95       = 0x000e,   ///< ISO Fortran 95.
469    eLanguageTypePLI             = 0x000f,   ///< ANSI PL/I:1976.
470    eLanguageTypeObjC            = 0x0010,   ///< Objective-C.
471    eLanguageTypeObjC_plus_plus  = 0x0011,   ///< Objective-C++.
472    eLanguageTypeUPC             = 0x0012,   ///< Unified Parallel C.
473    eLanguageTypeD               = 0x0013,   ///< D.
474    eLanguageTypePython          = 0x0014    ///< Python.
475} LanguageType;
476
477
478typedef enum AccessType
479{
480    eAccessNone,
481    eAccessPublic,
482    eAccessPrivate,
483    eAccessProtected,
484    eAccessPackage
485} AccessType;
486
487//----------------------------------------------------------------------
488/// Settable state variable types.
489///
490//----------------------------------------------------------------------
491
492typedef enum SettableVariableType
493{
494    eSetVarTypeInt,
495    eSetVarTypeBoolean,
496    eSetVarTypeString,
497    eSetVarTypeArray,
498    eSetVarTypeDictionary,
499    eSetVarTypeEnum,
500    eSetVarTypeNone
501} SettableVariableType;
502
503typedef enum VarSetOperationType
504{
505    eVarSetOperationReplace,
506    eVarSetOperationInsertBefore,
507    eVarSetOperationInsertAfter,
508    eVarSetOperationRemove,
509    eVarSetOperationAppend,
510    eVarSetOperationClear,
511    eVarSetOperationAssign,
512    eVarSetOperationInvalid
513} VarSetOperationType;
514
515//----------------------------------------------------------------------
516/// Command argument types.
517///
518//----------------------------------------------------------------------
519
520typedef enum CommandArgumentType
521{
522    eArgTypeAddress = 0,
523    eArgTypeAliasName,
524    eArgTypeAliasOptions,
525    eArgTypeArchitecture,
526    eArgTypeBoolean,
527    eArgTypeBreakpointID,
528    eArgTypeBreakpointIDRange,
529    eArgTypeByteSize,
530    eArgTypeCommandName,
531    eArgTypeCount,
532    eArgTypeEndAddress,
533    eArgTypeExpression,
534    eArgTypeExprFormat,
535    eArgTypeFilename,
536    eArgTypeFormat,
537    eArgTypeFrameIndex,
538    eArgTypeFullName,
539    eArgTypeFunctionName,
540    eArgTypeIndex,
541    eArgTypeLineNum,
542    eArgTypeLogCategory,
543    eArgTypeLogChannel,
544    eArgTypeMethod,
545    eArgTypeName,
546    eArgTypeNewPathPrefix,
547    eArgTypeNumLines,
548    eArgTypeNumberPerLine,
549    eArgTypeOffset,
550    eArgTypeOldPathPrefix,
551    eArgTypeOneLiner,
552    eArgTypePath,
553    eArgTypePid,
554    eArgTypePlugin,
555    eArgTypeProcessName,
556    eArgTypeQueueName,
557    eArgTypeRegisterName,
558    eArgTypeRegularExpression,
559    eArgTypeRunArgs,
560    eArgTypeRunMode,
561    eArgTypeScriptLang,
562    eArgTypeSearchWord,
563    eArgTypeSelector,
564    eArgTypeSettingIndex,
565    eArgTypeSettingKey,
566    eArgTypeSettingPrefix,
567    eArgTypeSettingVariableName,
568    eArgTypeShlibName,
569    eArgTypeSourceFile,
570    eArgTypeSortOrder,
571    eArgTypeStartAddress,
572    eArgTypeSymbol,
573    eArgTypeThreadID,
574    eArgTypeThreadIndex,
575    eArgTypeThreadName,
576    eArgTypeUnixSignal,
577    eArgTypeVarName,
578    eArgTypeValue,
579    eArgTypeWidth,
580    eArgTypeNone,
581    eArgTypeLastArg  // Always keep this entry as the last entry in this enumeration!!
582} CommandArgumentType;
583
584typedef enum ArgumentRepetitionType
585{
586    eArgRepeatPlain,            // Exactly one occurrence
587    eArgRepeatOptional,         // At most one occurrence, but it's optional
588    eArgRepeatPlus,             // One or more occurrences
589    eArgRepeatStar,             // Zero or more occurrences
590    eArgRepeatRange,            // Repetition of same argument, from 1 to n
591    eArgRepeatPairPlain,        // A pair of arguments that must always go together ([arg-type arg-value]), occurs exactly once
592    eArgRepeatPairOptional,     // A pair that occurs at most once (optional)
593    eArgRepeatPairPlus,         // One or more occurrences of a pair
594    eArgRepeatPairStar,         // Zero or more occurrences of a pair
595    eArgRepeatPairRange,        // A pair that repeats from 1 to n
596    eArgRepeatPairRangeOptional // A pair that repeats from 1 to n, but is optional
597} ArgumentRepetitionType;
598
599typedef enum SortOrder
600{
601    eSortOrderNone,
602    eSortOrderByAddress,
603    eSortOrderByName,
604} SortOrder;
605
606
607//----------------------------------------------------------------------
608// Used in conjunction with Host::GetLLDBResource () to find files that
609// are related to
610//----------------------------------------------------------------------
611typedef enum PathType
612{
613    ePathTypeLLDBShlibDir,          // The directory where the lldb.so (unix) or LLDB mach-o file in LLDB.framework (MacOSX) exists
614    ePathTypeSupportExecutableDir,  // Find LLDB support executable directory (debugserver, etc)
615    ePathTypeHeaderDir,             // Find LLDB header file directory
616    ePathTypePythonDir              // Find Python modules (PYTHONPATH) directory
617} PathType;
618
619
620//----------------------------------------------------------------------
621// We can execute ThreadPlans on one thread with various fall-back modes
622// (try other threads after timeout, etc.) This enum gives the result of
623// thread plan executions.
624//----------------------------------------------------------------------
625typedef enum ExecutionResults
626{
627    eExecutionSetupError,
628    eExecutionCompleted,
629    eExecutionDiscarded,
630    eExecutionInterrupted,
631    eExecutionTimedOut
632} ExecutionResults;
633
634} // namespace lldb
635
636
637#endif  // LLDB_enumerations_h_
638