lldb-types.h revision f125250ba7bcaa2ea5ee95539a309e3fd2f8b5d7
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 <pthread.h> 18#include <signal.h> 19#include <stdint.h> 20#include <stdbool.h> 21#include <unistd.h> 22 23//---------------------------------------------------------------------- 24// All host systems must define: 25// lldb::condition_t The native condition type (or a substitute class) for conditions on the host system. 26// lldb::mutex_t The native mutex type for mutex objects on the host system. 27// lldb::thread_t The native thread type for spawned threads on the system 28// lldb::thread_arg_t The type of the one any only thread creation argument for the host system 29// lldb::thread_result_t The return type that gets returned when a thread finishes. 30// lldb::thread_func_t The function prototype used to spawn a thread on the host system. 31// lldb::SharedPtr The template that wraps up the host version of a reference counted pointer (like boost::shared_ptr) 32// #define LLDB_INVALID_PROCESS_ID ... 33// #define LLDB_INVALID_THREAD_ID ... 34// #define LLDB_INVALID_HOST_THREAD ... 35// #define IS_VALID_LLDB_HOST_THREAD ... 36//---------------------------------------------------------------------- 37 38// TODO: Add a bunch of ifdefs to determine the host system and what 39// things should be defined. Currently MacOSX is being assumed by default 40// since that is what lldb was first developed for. 41 42namespace lldb { 43 //---------------------------------------------------------------------- 44 // MacOSX Types 45 //---------------------------------------------------------------------- 46 typedef ::pthread_mutex_t mutex_t; 47 typedef pthread_cond_t condition_t; 48 typedef pthread_t thread_t; // Host thread type 49 typedef void * thread_arg_t; // Host thread argument type 50 typedef void * thread_result_t; // Host thread result type 51 typedef void * (*thread_func_t)(void *); // Host thread function type 52 typedef void (*LogOutputCallback) (const char *, void *baton); 53 typedef bool (*CommandOverrideCallback)(void *baton, const char **argv); 54} // namespace lldb 55 56#if defined(__MINGW32__) 57 58const lldb::thread_t lldb_invalid_host_thread_const = { NULL, 0 } ; 59#define LLDB_INVALID_HOST_THREAD (lldb_invalid_host_thread_const) 60#define IS_VALID_LLDB_HOST_THREAD(t) (!(NULL == (t).p && 0 == (t).x)) 61 62#else 63 64#define LLDB_INVALID_HOST_THREAD ((lldb::thread_t)NULL) 65#define IS_VALID_LLDB_HOST_THREAD(t) ((t) != LLDB_INVALID_HOST_THREAD) 66 67#endif 68 69#define SHARED_PTR(T) std::tr1::shared_ptr<T> 70#define LLDB_INVALID_HOST_TIME { 0, 0 } 71 72namespace lldb 73{ 74 typedef uint64_t addr_t; 75 typedef uint64_t user_id_t; 76 typedef uint64_t pid_t; 77 typedef uint64_t tid_t; 78 typedef int32_t break_id_t; 79 typedef int32_t watch_id_t; 80 typedef void * clang_type_t; 81} 82 83 84#endif // LLDB_lldb_types_h_ 85