]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/lldb/lldb-types.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / include / lldb / lldb-types.h
1 //===-- lldb-types.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 #ifndef LLDB_lldb_types_h_
11 #define LLDB_lldb_types_h_
12
13 #include "lldb/lldb-enumerations.h"
14 #include "lldb/lldb-forward.h"
15
16 #include <assert.h>
17 #include <signal.h>
18 #include <stdint.h>
19
20 //----------------------------------------------------------------------
21 // All host systems must define:
22 //  lldb::condition_t       The native condition type (or a substitute class)
23 //  for conditions on the host system.
24 //  lldb::mutex_t           The native mutex type for mutex objects on the host
25 //  system.
26 //  lldb::thread_t          The native thread type for spawned threads on the
27 //  system
28 //  lldb::thread_arg_t      The type of the one any only thread creation
29 //  argument for the host system
30 //  lldb::thread_result_t   The return type that gets returned when a thread
31 //  finishes.
32 //  lldb::thread_func_t     The function prototype used to spawn a thread on the
33 //  host system.
34 //  #define LLDB_INVALID_PROCESS_ID ...
35 //  #define LLDB_INVALID_THREAD_ID ...
36 //  #define LLDB_INVALID_HOST_THREAD ...
37 //  #define IS_VALID_LLDB_HOST_THREAD ...
38 //----------------------------------------------------------------------
39
40 // TODO: Add a bunch of ifdefs to determine the host system and what
41 // things should be defined. Currently MacOSX is being assumed by default
42 // since that is what lldb was first developed for.
43
44 #ifndef _MSC_VER
45 #include <stdbool.h>
46 #include <unistd.h>
47 #endif
48
49 #ifdef _WIN32
50
51 #include <process.h>
52
53 namespace lldb {
54 typedef void *mutex_t;
55 typedef void *condition_t;
56 typedef void *rwlock_t;
57 typedef void *process_t;             // Process type is HANDLE
58 typedef void *thread_t;              // Host thread type
59 typedef void *file_t;                // Host file type
60 typedef void *pipe_t;                // Host pipe type
61 typedef unsigned int __w64 socket_t; // Host socket type
62 typedef uint32_t thread_key_t;
63 typedef void *thread_arg_t;                       // Host thread argument type
64 typedef unsigned thread_result_t;                 // Host thread result type
65 typedef thread_result_t (*thread_func_t)(void *); // Host thread function type
66 }
67
68 #else
69
70 #include <pthread.h>
71
72 namespace lldb {
73 //----------------------------------------------------------------------
74 // MacOSX Types
75 //----------------------------------------------------------------------
76 typedef ::pthread_mutex_t mutex_t;
77 typedef pthread_cond_t condition_t;
78 typedef pthread_rwlock_t rwlock_t;
79 typedef uint64_t process_t; // Process type is just a pid.
80 typedef pthread_t thread_t; // Host thread type
81 typedef int file_t;         // Host file type
82 typedef int pipe_t;         // Host pipe type
83 typedef int socket_t;       // Host socket type
84 typedef pthread_key_t thread_key_t;
85 typedef void *thread_arg_t;             // Host thread argument type
86 typedef void *thread_result_t;          // Host thread result type
87 typedef void *(*thread_func_t)(void *); // Host thread function type
88 } // namespace lldb
89
90 #endif
91
92 namespace lldb {
93 typedef void (*LogOutputCallback)(const char *, void *baton);
94 typedef bool (*CommandOverrideCallback)(void *baton, const char **argv);
95 typedef bool (*CommandOverrideCallbackWithResult)(
96     void *baton, const char **argv, lldb_private::CommandReturnObject &result);
97 typedef bool (*ExpressionCancelCallback)(ExpressionEvaluationPhase phase,
98                                          void *baton);
99 }
100
101 #define LLDB_INVALID_PROCESS ((lldb::process_t)-1)
102 #define LLDB_INVALID_HOST_THREAD ((lldb::thread_t)NULL)
103 #define IS_VALID_LLDB_HOST_THREAD(t) ((t) != LLDB_INVALID_HOST_THREAD)
104
105 #define LLDB_INVALID_HOST_TIME                                                 \
106   { 0, 0 }
107
108 namespace lldb {
109 typedef uint64_t addr_t;
110 typedef uint64_t user_id_t;
111 typedef uint64_t pid_t;
112 typedef uint64_t tid_t;
113 typedef uint64_t offset_t;
114 typedef int32_t break_id_t;
115 typedef int32_t watch_id_t;
116 typedef void *opaque_compiler_type_t;
117 typedef uint64_t queue_id_t;
118 }
119
120 #endif // LLDB_lldb_types_h_