• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- lldb-types.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 #ifndef LLDB_LLDB_TYPES_H
10 #define LLDB_LLDB_TYPES_H
11 
12 #include "lldb/lldb-enumerations.h"
13 #include "lldb/lldb-forward.h"
14 
15 #include <stdint.h>
16 
17 // All host systems must define:
18 //  lldb::thread_t          The native thread type for spawned threads on the
19 //  system
20 //  lldb::thread_arg_t      The type of the one any only thread creation
21 //  argument for the host system
22 //  lldb::thread_result_t   The return type that gets returned when a thread
23 //  finishes.
24 //  lldb::thread_func_t     The function prototype used to spawn a thread on the
25 //  host system.
26 //  #define LLDB_INVALID_PROCESS_ID ...
27 //  #define LLDB_INVALID_THREAD_ID ...
28 //  #define LLDB_INVALID_HOST_THREAD ...
29 
30 // TODO: Add a bunch of ifdefs to determine the host system and what
31 // things should be defined. Currently MacOSX is being assumed by default since
32 // that is what lldb was first developed for.
33 
34 #ifdef _WIN32
35 
36 #include <process.h>
37 
38 namespace lldb {
39 typedef void *rwlock_t;
40 typedef void *process_t;             // Process type is HANDLE
41 typedef void *thread_t;              // Host thread type
42 typedef void *file_t;                // Host file type
43 typedef unsigned int __w64 socket_t; // Host socket type
44 typedef void *thread_arg_t;                       // Host thread argument type
45 typedef unsigned thread_result_t;                 // Host thread result type
46 typedef thread_result_t (*thread_func_t)(void *); // Host thread function type
47 typedef void *pipe_t;                             // Host pipe type is HANDLE
48 } // namespace lldb
49 
50 #else
51 
52 #include <pthread.h>
53 
54 namespace lldb {
55 // MacOSX Types
56 typedef pthread_rwlock_t rwlock_t;
57 typedef uint64_t process_t; // Process type is just a pid.
58 typedef pthread_t thread_t; // Host thread type
59 typedef int file_t;         // Host file type
60 typedef int socket_t;       // Host socket type
61 typedef void *thread_arg_t;             // Host thread argument type
62 typedef void *thread_result_t;          // Host thread result type
63 typedef void *(*thread_func_t)(void *); // Host thread function type
64 typedef int pipe_t;                     // Host pipe type
65 } // namespace lldb
66 
67 #endif
68 
69 namespace lldb {
70 typedef void (*LogOutputCallback)(const char *, void *baton);
71 typedef bool (*CommandOverrideCallback)(void *baton, const char **argv);
72 typedef bool (*CommandOverrideCallbackWithResult)(
73     void *baton, const char **argv, lldb_private::CommandReturnObject &result);
74 typedef bool (*ExpressionCancelCallback)(ExpressionEvaluationPhase phase,
75                                          void *baton);
76 } // namespace lldb
77 
78 #define LLDB_INVALID_PROCESS ((lldb::process_t)-1)
79 #define LLDB_INVALID_HOST_THREAD ((lldb::thread_t)NULL)
80 #define LLDB_INVALID_PIPE ((lldb::pipe_t)-1)
81 
82 namespace lldb {
83 typedef uint64_t addr_t;
84 typedef uint64_t user_id_t;
85 typedef uint64_t pid_t;
86 typedef uint64_t tid_t;
87 typedef uint64_t offset_t;
88 typedef int32_t break_id_t;
89 typedef int32_t watch_id_t;
90 typedef void *opaque_compiler_type_t;
91 typedef uint64_t queue_id_t;
92 } // namespace lldb
93 
94 #endif // LLDB_LLDB_TYPES_H
95