dyntypes.h

Go to the documentation of this file.
00001 /*
00002  * See the dyninst/COPYRIGHT file for copyright information.
00003  * 
00004  * We provide the Paradyn Tools (below described as "Paradyn")
00005  * on an AS IS basis, and do not warrant its validity or performance.
00006  * We reserve the right to update, modify, or discontinue this
00007  * software at any time.  We shall have no obligation to supply such
00008  * updates or modifications or any other form of support to you.
00009  * 
00010  * By your use of Paradyn, you understand and agree that we (or any
00011  * other person or entity with proprietary rights in Paradyn) are
00012  * under no obligation to provide either maintenance services,
00013  * update services, notices of latent defects, or correction of
00014  * defects for Paradyn.
00015  * 
00016  * This library is free software; you can redistribute it and/or
00017  * modify it under the terms of the GNU Lesser General Public
00018  * License as published by the Free Software Foundation; either
00019  * version 2.1 of the License, or (at your option) any later version.
00020  * 
00021  * This library is distributed in the hope that it will be useful,
00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00024  * Lesser General Public License for more details.
00025  * 
00026  * You should have received a copy of the GNU Lesser General Public
00027  * License along with this library; if not, write to the Free Software
00028  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00029  */
00030 
00031 #if !defined(DYNTYPES_H)
00032 #define DYNTYPES_H
00033 
00034 #if defined(_MSC_VER)
00035 #define WIN32_LEAN_AND_MEAN
00036 #include <windows.h>
00037 #include <winsock2.h>
00038 #endif
00039 
00040 #ifndef FILE__
00041 #define FILE__ strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__
00042 #endif
00043 
00044 #if defined(_POWER) && !defined(__GNUC__)
00045 #define XLC
00046 #endif
00047 
00048 #if defined (_MSC_VER)
00049   //**************** Windows ********************
00050   #include <hash_map>
00051   #define dyn_hash_map stdext::hash_map
00052   #define dyn_hash_set std::hash_set
00053   #define DECLTHROW(x)
00054 #elif defined(__GNUC__)
00055   #include <functional>
00056   #define DECLTHROW(x) throw(x)
00057   //***************** GCC ***********************
00058    #if (__GNUC__ > 4) || \
00059       (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
00060       //**************** GCC >= 4.3.0 ***********
00061       #include <tr1/unordered_set>
00062       #include <tr1/unordered_map>
00063       #define cap_tr1
00064       #define dyn_hash_set std::tr1::unordered_set
00065       #define dyn_hash_map std::tr1::unordered_map
00066    #else
00067       //**************** GCC < 4.3.0 ************
00068       #include <ext/hash_map>
00069       #include <ext/hash_set>
00070       #include <string>
00071       #define dyn_hash_set __gnu_cxx::hash_set
00072       #define dyn_hash_map __gnu_cxx::hash_map    
00073       namespace Dyninst {
00074          unsigned ptrHash(void * addr);
00075       }
00076       using namespace __gnu_cxx;
00077       namespace __gnu_cxx {
00078 
00079           template<> struct hash<std::string> {
00080               hash<char*> h;
00081               unsigned operator()(const std::string &s) const 
00082               {
00083                   const char *cstr = s.c_str();
00084                   return h(cstr);
00085               };
00086           };
00087 
00088           template<> struct hash<void *> {
00089               unsigned operator()(void *v) const 
00090               {
00091                   return Dyninst::ptrHash(v);
00092               };
00093           };
00094 
00095       }
00096    #endif
00097 #elif defined(XLC)
00098   #define __IBMCPP_TR1__ 1
00099 
00100   #include <functional>
00101   #include <unordered_set>
00102   #include <unordered_map>
00103   #define dyn_hash_set std::tr1::unordered_set
00104   #define dyn_hash_map std::tr1::unordered_map
00105   #define DECLTHROW(x)
00106 #else
00107    #error Unknown compiler
00108 #endif
00109 
00110 
00111 namespace Dyninst
00112 {
00113    typedef unsigned long Address;   
00114    typedef unsigned long Offset;
00115 
00116 #if defined(_MSC_VER)
00117    typedef int PID;
00118    typedef HANDLE PROC_HANDLE;
00119    typedef HANDLE LWP;
00120    typedef HANDLE THR_ID;
00121    typedef DWORD psaddr_t; // for breakpoints; match the debug struct
00122 
00123 #define NULL_PID     -1
00124 #define NULL_LWP     INVALID_HANDLE_VALUE
00125 #define NULL_THR_ID     INVALID_HANDLE_VALUE
00126 #define DYNINST_SINGLETHREADED INVALID_HANDLE_VALUE
00127 #else
00128    typedef int PID;
00129    typedef int PROC_HANDLE;
00130    typedef int LWP;
00131    typedef long THR_ID;
00132 
00133 #define NULL_PID     -1
00134 #define NULL_LWP     -1
00135 #define NULL_THR_ID     -1
00136 #ifndef INVALID_HANDLE_VALUE
00137 #define INVALID_HANDLE_VALUE -1
00138 #endif
00139 #endif
00140 
00141    int ThrIDToTid(Dyninst::THR_ID id);
00142 }
00143 
00144 namespace Dyninst
00145 {
00146    typedef enum {
00147       OSNone,
00148       Linux,
00149       FreeBSD,
00150       Windows,
00151       VxWorks,
00152       BlueGeneL,
00153       BlueGeneP,
00154       BlueGeneQ
00155    } OSType;
00156 }
00157 
00158 #include "dyn_regs.h"
00159 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1