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