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