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