1 //===-- lldb-defines.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_DEFINES_H 10 #define LLDB_LLDB_DEFINES_H 11 12 #include "lldb/lldb-types.h" 13 14 #if !defined(INT32_MAX) 15 #define INT32_MAX 2147483647 16 #endif 17 18 #if !defined(UINT32_MAX) 19 #define UINT32_MAX 4294967295U 20 #endif 21 22 #if !defined(UINT64_MAX) 23 #define UINT64_MAX 18446744073709551615ULL 24 #endif 25 26 // LLDB version 27 // 28 // A build script phase can modify this version number if needed. 29 //#define LLDB_VERSION 30 //#define LLDB_REVISION 31 //#define LLDB_VERSION_STRING 32 33 // LLDB defines 34 #define LLDB_GENERIC_ERROR UINT32_MAX 35 36 // Breakpoints 37 #define LLDB_INVALID_BREAK_ID 0 38 #define LLDB_DEFAULT_BREAK_SIZE 0 39 #define LLDB_BREAK_ID_IS_VALID(bid) ((bid) != (LLDB_INVALID_BREAK_ID)) 40 #define LLDB_BREAK_ID_IS_INTERNAL(bid) ((bid) < 0) 41 42 // Watchpoints 43 #define LLDB_INVALID_WATCH_ID 0 44 #define LLDB_WATCH_ID_IS_VALID(uid) ((uid) != (LLDB_INVALID_WATCH_ID)) 45 #define LLDB_WATCH_TYPE_READ (1u << 0) 46 #define LLDB_WATCH_TYPE_WRITE (1u << 1) 47 #define LLDB_WATCH_TYPE_MODIFY (1u << 2) 48 #define LLDB_WATCH_TYPE_IS_VALID(type) \ 49 ((type & LLDB_WATCH_TYPE_READ) || (type & LLDB_WATCH_TYPE_WRITE) || \ 50 (type & LLDB_WATCH_TYPE_MODIFY)) 51 52 // StopPointSites 53 #define LLDB_INVALID_SITE_ID UINT32_MAX 54 55 // Generic Register Numbers 56 #define LLDB_REGNUM_GENERIC_PC 0 // Program Counter 57 #define LLDB_REGNUM_GENERIC_SP 1 // Stack Pointer 58 #define LLDB_REGNUM_GENERIC_FP 2 // Frame Pointer 59 #define LLDB_REGNUM_GENERIC_RA 3 // Return Address 60 #define LLDB_REGNUM_GENERIC_FLAGS 4 // Processor flags register 61 #define LLDB_REGNUM_GENERIC_ARG1 \ 62 5 // The register that would contain pointer size or less argument 1 (if any) 63 #define LLDB_REGNUM_GENERIC_ARG2 \ 64 6 // The register that would contain pointer size or less argument 2 (if any) 65 #define LLDB_REGNUM_GENERIC_ARG3 \ 66 7 // The register that would contain pointer size or less argument 3 (if any) 67 #define LLDB_REGNUM_GENERIC_ARG4 \ 68 8 // The register that would contain pointer size or less argument 4 (if any) 69 #define LLDB_REGNUM_GENERIC_ARG5 \ 70 9 // The register that would contain pointer size or less argument 5 (if any) 71 #define LLDB_REGNUM_GENERIC_ARG6 \ 72 10 // The register that would contain pointer size or less argument 6 (if any) 73 #define LLDB_REGNUM_GENERIC_ARG7 \ 74 11 // The register that would contain pointer size or less argument 7 (if any) 75 #define LLDB_REGNUM_GENERIC_ARG8 \ 76 12 // The register that would contain pointer size or less argument 8 (if any) 77 #define LLDB_REGNUM_GENERIC_TP \ 78 13 // The register that would contain thread specific data, like TLS data and 79 // thread control block pointer 80 /// Invalid value definitions 81 #define LLDB_INVALID_STOP_ID 0 82 #define LLDB_INVALID_ADDRESS UINT64_MAX 83 #define LLDB_INVALID_INDEX32 UINT32_MAX 84 #define LLDB_INVALID_IVAR_OFFSET UINT32_MAX 85 #define LLDB_INVALID_IMAGE_TOKEN UINT32_MAX 86 #define LLDB_INVALID_MODULE_VERSION UINT32_MAX 87 #define LLDB_INVALID_REGNUM UINT32_MAX 88 #define LLDB_INVALID_UID UINT64_MAX 89 #define LLDB_INVALID_PROCESS_ID 0 90 #define LLDB_INVALID_THREAD_ID 0 91 #define LLDB_INVALID_FRAME_ID UINT32_MAX 92 #define LLDB_INVALID_SIGNAL_NUMBER INT32_MAX 93 #define LLDB_INVALID_OFFSET UINT64_MAX // Must match max of lldb::offset_t 94 #define LLDB_INVALID_LINE_NUMBER UINT32_MAX 95 #define LLDB_INVALID_COLUMN_NUMBER 0 96 #define LLDB_INVALID_QUEUE_ID 0 97 #define LLDB_INVALID_CPU_ID UINT32_MAX 98 #define LLDB_INVALID_WATCHPOINT_RESOURCE_ID UINT32_MAX 99 100 /// CPU Type definitions 101 #define LLDB_ARCH_DEFAULT "systemArch" 102 #define LLDB_ARCH_DEFAULT_32BIT "systemArch32" 103 #define LLDB_ARCH_DEFAULT_64BIT "systemArch64" 104 #define LLDB_INVALID_CPUTYPE (0xFFFFFFFEu) 105 106 /// Option Set definitions 107 // FIXME: I'm sure there's some #define magic that can create all 32 sets on the 108 // fly. That would have the added benefit of making this unreadable. 109 #define LLDB_MAX_NUM_OPTION_SETS 32 110 #define LLDB_OPT_SET_ALL 0xFFFFFFFFU 111 #define LLDB_OPT_SET_1 (1U << 0) 112 #define LLDB_OPT_SET_2 (1U << 1) 113 #define LLDB_OPT_SET_3 (1U << 2) 114 #define LLDB_OPT_SET_4 (1U << 3) 115 #define LLDB_OPT_SET_5 (1U << 4) 116 #define LLDB_OPT_SET_6 (1U << 5) 117 #define LLDB_OPT_SET_7 (1U << 6) 118 #define LLDB_OPT_SET_8 (1U << 7) 119 #define LLDB_OPT_SET_9 (1U << 8) 120 #define LLDB_OPT_SET_10 (1U << 9) 121 #define LLDB_OPT_SET_11 (1U << 10) 122 #define LLDB_OPT_SET_12 (1U << 11) 123 #define LLDB_OPT_SET_FROM_TO(A, B) \ 124 (((1U << (B)) - 1) ^ (((1U << (A)) - 1) >> 1)) 125 126 #if defined(_WIN32) && !defined(MAX_PATH) 127 #define MAX_PATH 260 128 #endif 129 130 /// Address Mask 131 /// Bits not used for addressing are set to 1 in the mask; 132 /// all mask bits set is an invalid value. 133 #define LLDB_INVALID_ADDRESS_MASK UINT64_MAX 134 135 // ignore GCC function attributes 136 #if defined(_MSC_VER) && !defined(__clang__) 137 #define __attribute__(X) 138 #endif 139 140 #define UNUSED_IF_ASSERT_DISABLED(x) ((void)(x)) 141 142 #define LLDB_DEPRECATED(MSG) \ 143 [[deprecated("This method is no longer supported: " MSG)]] 144 145 #if defined(__clang__) 146 #define LLDB_DEPRECATED_FIXME(MSG, FIX) __attribute__((deprecated(MSG, FIX))) 147 #else 148 #define LLDB_DEPRECATED_FIXME(MSG, FIX) LLDB_DEPRECATED(MSG) 149 #endif 150 151 #endif // LLDB_LLDB_DEFINES_H 152