1 //===-- RNBDefs.h -----------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  Created by Greg Clayton on 12/14/07.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef __RNBDefs_h__
15 #define __RNBDefs_h__
16 
17 #include "DNBDefs.h"
18 #include <memory>
19 
20 extern "C" const unsigned char debugserverVersionString[];
21 extern "C" const double debugserverVersionNumber;
22 #define DEBUGSERVER_PROGRAM_NAME "debugserver"
23 #define DEBUGSERVER_VERSION_STR debugserverVersionString
24 #define DEBUGSERVER_VERSION_NUM debugserverVersionNumber
25 
26 #if defined (__i386__)
27 
28 #define RNB_ARCH    "i386"
29 
30 #elif defined (__x86_64__)
31 
32 #define RNB_ARCH    "x86_64"
33 
34 #elif defined (__ppc64__)
35 
36 #define RNB_ARCH    "ppc64"
37 
38 #elif defined (__powerpc__) || defined (__ppc__)
39 
40 #define RNB_ARCH    "ppc"
41 
42 #elif defined (__arm__)
43 
44 #define RNB_ARCH    "armv7"
45 
46 #else
47 
48 #error undefined architecture
49 
50 #endif
51 
52 class RNBRemote;
53 typedef std::shared_ptr<RNBRemote> RNBRemoteSP;
54 
55 typedef enum
56 {
57     rnb_success = 0,
58     rnb_err = 1,
59     rnb_not_connected = 2
60 } rnb_err_t;
61 
62 // Log bits
63 // reserve low bits for DNB
64 #define LOG_RNB_MINIMAL     ((LOG_LO_USER) << 0)  // Minimal logging    (min verbosity)
65 #define LOG_RNB_MEDIUM      ((LOG_LO_USER) << 1)  // Medium logging     (med verbosity)
66 #define LOG_RNB_MAX         ((LOG_LO_USER) << 2)  // Max logging        (max verbosity)
67 #define LOG_RNB_COMM        ((LOG_LO_USER) << 3)  // Log communications (RNBSocket)
68 #define LOG_RNB_REMOTE      ((LOG_LO_USER) << 4)  // Log remote         (RNBRemote)
69 #define LOG_RNB_EVENTS      ((LOG_LO_USER) << 5)  // Log events         (PThreadEvents)
70 #define LOG_RNB_PROC        ((LOG_LO_USER) << 6)  // Log process state  (Process thread)
71 #define LOG_RNB_PACKETS     ((LOG_LO_USER) << 7)  // Log gdb remote packets
72 #define LOG_RNB_ALL         (~((LOG_LO_USER) - 1))
73 #define LOG_RNB_DEFAULT     (LOG_RNB_ALL)
74 
75 extern RNBRemoteSP g_remoteSP;
76 
77 #endif // #ifndef __RNBDefs_h__
78