1 //===-- RNBDefs.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 // Created by Greg Clayton on 12/14/07. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLDB_TOOLS_DEBUGSERVER_SOURCE_RNBDEFS_H 14 #define LLDB_TOOLS_DEBUGSERVER_SOURCE_RNBDEFS_H 15 16 #include "DNBDefs.h" 17 #include <memory> 18 19 #define CONCAT2(a, b) a##b 20 #define CONCAT(a, b) CONCAT2(a, b) 21 #define STRINGIZE2(x) #x 22 #define STRINGIZE(x) STRINGIZE2(x) 23 24 #if !defined(DEBUGSERVER_PROGRAM_SYMBOL) 25 #define DEBUGSERVER_PROGRAM_SYMBOL debugserver 26 #endif 27 28 #if !defined(DEBUGSERVER_PROGRAM_NAME) 29 #define DEBUGSERVER_PROGRAM_NAME STRINGIZE(DEBUGSERVER_PROGRAM_SYMBOL) 30 #endif 31 32 #ifndef DEBUGSERVER_VERSION_NUM 33 extern "C" const unsigned char CONCAT(DEBUGSERVER_PROGRAM_SYMBOL, 34 VersionString)[]; 35 #define DEBUGSERVER_VERSION_NUM \ 36 CONCAT(DEBUGSERVER_PROGRAM_SYMBOL, VersionNumber) 37 #endif 38 39 #ifndef DEBUGSERVER_VERSION_STR 40 extern "C" const double CONCAT(DEBUGSERVER_PROGRAM_SYMBOL, VersionNumber); 41 #define DEBUGSERVER_VERSION_STR \ 42 CONCAT(DEBUGSERVER_PROGRAM_SYMBOL, VersionString) 43 #endif 44 45 #if defined(__i386__) 46 47 #define RNB_ARCH "i386" 48 49 #elif defined(__x86_64__) 50 51 #define RNB_ARCH "x86_64" 52 53 #elif defined(__arm64__) || defined(__aarch64__) 54 55 #define RNB_ARCH "arm64" 56 57 #elif defined(__arm__) 58 59 #define RNB_ARCH "armv7" 60 61 #else 62 63 #error undefined architecture 64 65 #endif 66 67 class RNBRemote; 68 typedef std::shared_ptr<RNBRemote> RNBRemoteSP; 69 70 enum rnb_err_t { rnb_success = 0, rnb_err = 1, rnb_not_connected = 2 }; 71 72 // Log bits 73 // reserve low bits for DNB 74 #define LOG_RNB_MINIMAL \ 75 ((LOG_LO_USER) << 0) // Minimal logging (min verbosity) 76 #define LOG_RNB_MEDIUM \ 77 ((LOG_LO_USER) << 1) // Medium logging (med verbosity) 78 #define LOG_RNB_MAX ((LOG_LO_USER) << 2) // Max logging (max verbosity) 79 #define LOG_RNB_COMM ((LOG_LO_USER) << 3) // Log communications (RNBSocket) 80 #define LOG_RNB_REMOTE ((LOG_LO_USER) << 4) // Log remote (RNBRemote) 81 #define LOG_RNB_EVENTS \ 82 ((LOG_LO_USER) << 5) // Log events (PThreadEvents) 83 #define LOG_RNB_PROC ((LOG_LO_USER) << 6) // Log process state (Process thread) 84 #define LOG_RNB_PACKETS ((LOG_LO_USER) << 7) // Log gdb remote packets 85 #define LOG_RNB_ALL (~((LOG_LO_USER)-1)) 86 #define LOG_RNB_DEFAULT (LOG_RNB_ALL) 87 88 extern RNBRemoteSP g_remoteSP; 89 90 #endif // LLDB_TOOLS_DEBUGSERVER_SOURCE_RNBDEFS_H 91