Home | History | Annotate | Download | only in lldb
      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 //  #define LLDB_INVALID_PROCESS_ID ...
     32 //  #define LLDB_INVALID_THREAD_ID ...
     33 //  #define LLDB_INVALID_HOST_THREAD ...
     34 //  #define IS_VALID_LLDB_HOST_THREAD ...
     35 //----------------------------------------------------------------------
     36 
     37 // TODO: Add a bunch of ifdefs to determine the host system and what
     38 // things should be defined. Currently MacOSX is being assumed by default
     39 // since that is what lldb was first developed for.
     40 
     41 namespace lldb {
     42         //----------------------------------------------------------------------
     43         // MacOSX Types
     44         //----------------------------------------------------------------------
     45         typedef ::pthread_mutex_t   mutex_t;
     46         typedef pthread_cond_t      condition_t;
     47         typedef pthread_t           thread_t;                   // Host thread type
     48         typedef void *              thread_arg_t;               // Host thread argument type
     49         typedef void *              thread_result_t;            // Host thread result type
     50         typedef void *              (*thread_func_t)(void *);   // Host thread function type
     51         typedef void                (*LogOutputCallback) (const char *, void *baton);
     52         typedef bool                (*CommandOverrideCallback)(void *baton, const char **argv);
     53 } // namespace lldb
     54 
     55 #if defined(__MINGW32__)
     56 
     57 const lldb::thread_t lldb_invalid_host_thread_const = { NULL, 0 } ;
     58 #define LLDB_INVALID_HOST_THREAD         (lldb_invalid_host_thread_const)
     59 #define IS_VALID_LLDB_HOST_THREAD(t)     (!(NULL == (t).p && 0 == (t).x))
     60 
     61 #else
     62 
     63 #define LLDB_INVALID_HOST_THREAD         ((lldb::thread_t)NULL)
     64 #define IS_VALID_LLDB_HOST_THREAD(t)     ((t) != LLDB_INVALID_HOST_THREAD)
     65 
     66 #endif
     67 
     68 #define LLDB_INVALID_HOST_TIME           { 0, 0 }
     69 
     70 namespace lldb
     71 {
     72     typedef uint64_t    addr_t;
     73     typedef uint64_t    user_id_t;
     74     typedef uint64_t    pid_t;
     75     typedef uint64_t    tid_t;
     76     typedef uint64_t    offset_t;
     77     typedef int32_t     break_id_t;
     78     typedef int32_t     watch_id_t;
     79     typedef void *      clang_type_t;
     80 }
     81 
     82 
     83 #endif  // LLDB_lldb_types_h_
     84