• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- lldb-defines.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_defines_h_
11 #define LLDB_lldb_defines_h_
12 
13 #include "lldb/lldb-types.h"
14 
15 #if !defined(UINT32_MAX)
16     #define UINT32_MAX 4294967295U
17 #endif
18 
19 #if !defined(UINT64_MAX)
20     #define UINT64_MAX 18446744073709551615ULL
21 #endif
22 
23 //----------------------------------------------------------------------
24 // LLDB version
25 //
26 // A build script phase can modify this version number if needed.
27 //----------------------------------------------------------------------
28 //#define LLDB_VERSION
29 //#define LLDB_REVISION
30 //#define LLDB_VERSION_STRING
31 
32 //----------------------------------------------------------------------
33 // LLDB defines
34 //----------------------------------------------------------------------
35 #define LLDB_GENERIC_ERROR              UINT32_MAX
36 
37 //----------------------------------------------------------------------
38 // Breakpoints
39 //----------------------------------------------------------------------
40 #define LLDB_INVALID_BREAK_ID           0
41 #define LLDB_DEFAULT_BREAK_SIZE         0
42 #define LLDB_BREAK_ID_IS_VALID(bid)     ((bid) != (LLDB_INVALID_BREAK_ID))
43 #define LLDB_BREAK_ID_IS_INTERNAL(bid)  ((bid) < 0)
44 
45 //----------------------------------------------------------------------
46 // Watchpoints
47 //----------------------------------------------------------------------
48 #define LLDB_INVALID_WATCH_ID           0
49 #define LLDB_WATCH_ID_IS_VALID(uid)     ((uid) != (LLDB_INVALID_WATCH_ID))
50 #define LLDB_WATCH_TYPE_READ            (1u << 0)
51 #define LLDB_WATCH_TYPE_WRITE           (1u << 1)
52 #define LLDB_WATCH_TYPE_IS_VALID(type)  ((type | LLDB_WATCH_TYPE_READ) || (type | LLDB_WATCH_TYPE_WRITE))
53 
54 //----------------------------------------------------------------------
55 // Generic Register Numbers
56 //----------------------------------------------------------------------
57 #define LLDB_REGNUM_GENERIC_PC          0   // Program Counter
58 #define LLDB_REGNUM_GENERIC_SP          1   // Stack Pointer
59 #define LLDB_REGNUM_GENERIC_FP          2   // Frame Pointer
60 #define LLDB_REGNUM_GENERIC_RA          3   // Return Address
61 #define LLDB_REGNUM_GENERIC_FLAGS       4   // Processor flags register
62 #define LLDB_REGNUM_GENERIC_ARG1        5   // The register that would contain pointer size or less argument 1 (if any)
63 #define LLDB_REGNUM_GENERIC_ARG2        6   // The register that would contain pointer size or less argument 2 (if any)
64 #define LLDB_REGNUM_GENERIC_ARG3        7   // The register that would contain pointer size or less argument 3 (if any)
65 #define LLDB_REGNUM_GENERIC_ARG4        8   // The register that would contain pointer size or less argument 4 (if any)
66 #define LLDB_REGNUM_GENERIC_ARG5        9   // The register that would contain pointer size or less argument 5 (if any)
67 #define LLDB_REGNUM_GENERIC_ARG6        10  // The register that would contain pointer size or less argument 6 (if any)
68 #define LLDB_REGNUM_GENERIC_ARG7        11  // The register that would contain pointer size or less argument 7 (if any)
69 #define LLDB_REGNUM_GENERIC_ARG8        12  // The register that would contain pointer size or less argument 8 (if any)
70 //---------------------------------------------------------------------
71 /// Invalid value definitions
72 //----------------------------------------------------------------------
73 #define LLDB_INVALID_ADDRESS            UINT64_MAX
74 #define LLDB_INVALID_INDEX32            UINT32_MAX
75 #define LLDB_INVALID_IVAR_OFFSET        UINT32_MAX
76 #define LLDB_INVALID_IMAGE_TOKEN        UINT32_MAX
77 #define LLDB_INVALID_REGNUM             UINT32_MAX
78 #define LLDB_INVALID_UID                UINT64_MAX
79 #define LLDB_INVALID_PROCESS_ID         0
80 #define LLDB_INVALID_THREAD_ID          0
81 #define LLDB_INVALID_FRAME_ID           UINT32_MAX
82 #define LLDB_INVALID_SIGNAL_NUMBER      INT32_MAX
83 #define LLDB_INVALID_OFFSET             UINT64_MAX // Must match max of lldb::offset_t
84 
85 //----------------------------------------------------------------------
86 /// CPU Type defintions
87 //----------------------------------------------------------------------
88 #define LLDB_ARCH_DEFAULT               "systemArch"
89 #define LLDB_ARCH_DEFAULT_32BIT         "systemArch32"
90 #define LLDB_ARCH_DEFAULT_64BIT         "systemArch64"
91 #define LLDB_INVALID_CPUTYPE            (0xFFFFFFFEu)
92 
93 //----------------------------------------------------------------------
94 /// Option Set defintions
95 //----------------------------------------------------------------------
96 // FIXME: I'm sure there's some #define magic that can create all 32 sets on the
97 // fly.  That would have the added benefit of making this unreadable.
98 #define LLDB_MAX_NUM_OPTION_SETS        32
99 #define LLDB_OPT_SET_ALL                0xFFFFFFFFU
100 #define LLDB_OPT_SET_1                  (1U << 0)
101 #define LLDB_OPT_SET_2                  (1U << 1)
102 #define LLDB_OPT_SET_3                  (1U << 2)
103 #define LLDB_OPT_SET_4                  (1U << 3)
104 #define LLDB_OPT_SET_5                  (1U << 4)
105 #define LLDB_OPT_SET_6                  (1U << 5)
106 #define LLDB_OPT_SET_7                  (1U << 6)
107 #define LLDB_OPT_SET_8                  (1U << 7)
108 #define LLDB_OPT_SET_9                  (1U << 8)
109 #define LLDB_OPT_SET_10                 (1U << 9)
110 #define LLDB_OPT_SET_FROM_TO(A, B)      (((1U << (B)) - 1) ^ (((1U << (A))-1) >> 1))
111 
112 #if defined(__cplusplus)
113 
114 //----------------------------------------------------------------------
115 /// @def DISALLOW_COPY_AND_ASSIGN(TypeName)
116 ///     Macro definition for easily disallowing copy constructor and
117 ///     assignment operators in C++ classes.
118 //----------------------------------------------------------------------
119 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
120     TypeName(const TypeName&); \
121     const TypeName& operator=(const TypeName&)
122 
123 #endif // #if defined(__cplusplus)
124 
125 #endif  // LLDB_lldb_defines_h_
126