util.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #if !defined(SYMTAB_EXPORT)
00033 #if defined(_MSC_VER)
00034 #if defined SYMTAB_LIB
00035 #define SYMTAB_EXPORT __declspec(dllexport)
00036 #else
00037 #define SYMTAB_EXPORT __declspec(dllimport)
00038 #endif
00039 #else
00040 #define SYMTAB_EXPORT
00041 #endif
00042 #endif
00043
00044 #if !defined(COMMON_EXPORT)
00045 #if defined (_MSC_VER)
00046 #if defined(COMMON_LIB)
00047 #define COMMON_EXPORT __declspec(dllexport)
00048 #else
00049 #define COMMON_EXPORT __declspec(dllimport)
00050 #endif
00051 #else
00052 #define COMMON_EXPORT
00053 #endif
00054 #endif
00055
00056 #if !defined(COMMON_TEMPLATE_EXPORT)
00057 #if defined (_MSC_VER)
00058 #if defined(COMMON_LIB) || defined(INSTRUCTION_LIB) || \
00059 defined(SYMTAB_LIB) || defined(BPATCH_LIBRARY)
00060 #define COMMON_TEMPLATE_EXPORT __declspec(dllexport)
00061 #else
00062 #define COMMON_TEMPLATE_EXPORT __declspec(dllimport)
00063 #endif
00064 #else
00065 #define COMMON_TEMPLATE_EXPORT
00066 #endif
00067 #endif
00068
00069 #if !defined(INSTRUCTION_EXPORT)
00070 #if defined(_MSC_VER)
00071 #if defined(INSTRUCTION_LIB)
00072 #define INSTRUCTION_EXPORT __declspec(dllexport)
00073 #else
00074 #define INSTRUCTION_EXPORT __declspec(dllimport)
00075 #endif
00076 #else
00077 #define INSTRUCTION_EXPORT
00078 #endif
00079 #endif
00080
00081 #if !defined(PARSER_EXPORT)
00082 #if defined(_MSC_VER)
00083 #if defined(PARSER_LIB)
00084 #define PARSER_EXPORT __declspec(dllexport)
00085 #else
00086 #define PARSER_EXPORT __declspec(dllimport)
00087 #endif
00088 #else
00089 #define PARSER_EXPORT
00090 #endif
00091 #endif
00092
00093 #if !defined(PATCHAPI_EXPORT)
00094 #if defined(_MSC_VER)
00095 #if defined(PATCHAPI_LIB)
00096 #define PATCHAPI_EXPORT __declspec(dllexport)
00097 #else
00098 #define PATCHAPI_EXPORT __declspec(dllimport)
00099 #endif
00100 #else
00101 #define PATCHAPI_EXPORT
00102 #endif
00103 #endif
00104
00105 #if !defined(DATAFLOW_EXPORT)
00106 #if defined(_MSC_VER)
00107 #if defined(DATAFLOW_LIB)
00108 #define DATAFLOW_EXPORT __declspec(dllexport)
00109 #else
00110 #define DATAFLOW_EXPORT __declspec(dllimport)
00111 #endif
00112 #else
00113 #define DATAFLOW_EXPORT
00114 #endif
00115 #endif
00116
00117 #if !defined(PC_EXPORT)
00118 #if defined(_MSC_VER)
00119 #if defined(PROCCONTROL_EXPORTS)
00120 #define PC_EXPORT __declspec(dllexport)
00121 #else
00122 #define PC_EXPORT __declspec(dllimport)
00123 #endif
00124 #else
00125 #define PC_EXPORT
00126 #endif
00127 #endif
00128
00129 #if !defined(SW_EXPORT)
00130 #if defined(_MSC_VER)
00131 #if defined(STACKWALKER_EXPORTS)
00132 #define SW_EXPORT __declspec(dllexport)
00133 #else
00134 #define SW_EXPORT __declspec(dllimport)
00135 #endif
00136 #else
00137 #define SW_EXPORT
00138 #endif
00139 #endif
00140
00141 #if !defined(INJECTOR_EXPORT)
00142 #if defined(_MSC_VER)
00143 #if defined(INJECTOR_EXPORTS)
00144 #define INJECTOR_EXPORT __declspec(dllexport)
00145 #else
00146 #define INJECTOR_EXPORT __declspec(dllimport)
00147 #endif
00148 #else
00149 #define INJECTOR_EXPORT
00150 #endif
00151 #endif
00152
00153 #if !defined(SYMEVAL_EXPORT)
00154 #if defined(_MSC_VER)
00155 #if defined(SYMEVAL_LIB)
00156 #define SYMEVAL_EXPORT __declspec(dllexport)
00157 #else
00158 #define SYMEVAL_EXPORT __declspec(dllimport)
00159 #endif
00160 #else
00161 #define SYMEVAL_EXPORT
00162 #endif
00163 #endif
00164
00165 #if !defined(THROW) && !defined(THROW_SPEC)
00166 #if defined(_MSC_VER)
00167 #define THROW_SPEC(x)
00168 #define THROW
00169 #else
00170 #define THROW_SPEC(x) throw (x)
00171 #define THROW throw ()
00172 #endif
00173 #endif
00174
00175 #ifndef __UTIL_H__
00176 #define __UTIL_H__
00177
00178 #include <string>
00179 #include "dyntypes.h"
00180
00181
00182
00183
00184
00185 #if !((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__))
00186 #if (__GNUC__ == 4 && __GNUC_MINOR__ == 7 && ((__GNUC_PATCHLEVEL__ == 0) || (__GNUC_PATCHLEVEL__ == 1)))
00187 #error "Using GCC 4.7.0 or 4.7.1 with Dyninst requires the -std:c++0x or -std:c++11 flag. Other versions do not."
00188 #endif
00189 #endif
00190
00191
00192 namespace Dyninst {
00193
00194 COMMON_EXPORT unsigned addrHashCommon(const Address &addr);
00195 COMMON_EXPORT unsigned ptrHash(const void * addr);
00196 COMMON_EXPORT unsigned ptrHash(void * addr);
00197
00198 COMMON_EXPORT unsigned addrHash(const Address &addr);
00199 COMMON_EXPORT unsigned addrHash4(const Address &addr);
00200 COMMON_EXPORT unsigned addrHash16(const Address &addr);
00201
00202 COMMON_EXPORT unsigned stringhash(const std::string &s);
00203 COMMON_EXPORT std::string itos(int);
00204 COMMON_EXPORT std::string utos(unsigned);
00205
00206 #define WILDCARD_CHAR '?'
00207 #define MULTIPLE_WILDCARD_CHAR '*'
00208
00209 COMMON_EXPORT bool wildcardEquiv(const std::string &us, const std::string &them, bool checkCase = false );
00210
00211 const char *platform_string();
00212 }
00213
00214 #endif