[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / lldb / tools / debugserver / source / RNBDefs.h
bloba5322ae25f8cd72d56c2b6f5a58313fcb96a5547
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.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLDB_TOOLS_DEBUGSERVER_SOURCE_RNBDEFS_H
14 #define LLDB_TOOLS_DEBUGSERVER_SOURCE_RNBDEFS_H
16 #include "DNBDefs.h"
17 #include <memory>
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)
24 #if !defined(DEBUGSERVER_PROGRAM_SYMBOL)
25 #define DEBUGSERVER_PROGRAM_SYMBOL debugserver
26 #endif
28 #if !defined(DEBUGSERVER_PROGRAM_NAME)
29 #define DEBUGSERVER_PROGRAM_NAME STRINGIZE(DEBUGSERVER_PROGRAM_SYMBOL)
30 #endif
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
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
45 #if defined(__i386__)
47 #define RNB_ARCH "i386"
49 #elif defined(__x86_64__)
51 #define RNB_ARCH "x86_64"
53 #elif defined(__arm64__) || defined(__aarch64__)
55 #define RNB_ARCH "arm64"
57 #elif defined(__arm__)
59 #define RNB_ARCH "armv7"
61 #else
63 #error undefined architecture
65 #endif
67 class RNBRemote;
68 typedef std::shared_ptr<RNBRemote> RNBRemoteSP;
70 enum rnb_err_t { rnb_success = 0, rnb_err = 1, rnb_not_connected = 2 };
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)
88 extern RNBRemoteSP g_remoteSP;
90 #endif // LLDB_TOOLS_DEBUGSERVER_SOURCE_RNBDEFS_H