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