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