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
00033
00034
00035
00036
00037 #ifndef HPROF_ERROR_H
00038 #define HPROF_ERROR_H
00039
00040
00041
00042 #define HPROF_BOOL(x) ((jboolean)((x)==0?JNI_FALSE:JNI_TRUE))
00043
00044 #define HPROF_ERROR(fatal,msg) \
00045 error_handler(HPROF_BOOL(fatal), JVMTI_ERROR_NONE, msg, __FILE__, __LINE__)
00046
00047 #define HPROF_JVMTI_ERROR(error,msg) \
00048 error_handler(HPROF_BOOL(error!=JVMTI_ERROR_NONE), \
00049 error, msg, __FILE__, __LINE__)
00050
00051 #if defined(DEBUG) || !defined(NDEBUG)
00052 #define HPROF_ASSERT(cond) \
00053 (((int)(cond))?(void)0:error_assert(#cond, __FILE__, __LINE__))
00054 #else
00055 #define HPROF_ASSERT(cond)
00056 #endif
00057
00058 #define LOG_DUMP_MISC 0x1
00059 #define LOG_DUMP_LISTS 0x2
00060 #define LOG_CHECK_BINARY 0x4
00061
00062 #ifdef HPROF_LOGGING
00063 #define LOG_STDERR(args) \
00064 { \
00065 if ( gdata != NULL && (gdata->logflags & LOG_DUMP_MISC) ) { \
00066 (void)fprintf args ; \
00067 } \
00068 }
00069 #else
00070 #define LOG_STDERR(args)
00071 #endif
00072
00073 #define LOG_FORMAT(format) "HPROF LOG: " format " [%s:%d]\n"
00074
00075 #define LOG1(str1) LOG_STDERR((stderr, LOG_FORMAT("%s"), \
00076 str1, __FILE__, __LINE__ ))
00077 #define LOG2(str1,str2) LOG_STDERR((stderr, LOG_FORMAT("%s %s"), \
00078 str1, str2, __FILE__, __LINE__ ))
00079 #define LOG3(str1,str2,num) LOG_STDERR((stderr, LOG_FORMAT("%s %s 0x%x"), \
00080 str1, str2, num, __FILE__, __LINE__ ))
00081
00082 #define LOG(str) LOG1(str)
00083
00084 void error_handler(jboolean fatal, jvmtiError error,
00085 const char *message, const char *file, int line);
00086 void error_assert(const char *condition, const char *file, int line);
00087 void error_exit_process(int exit_code);
00088 void error_do_pause(void);
00089 void error_setup(void);
00090 void debug_message(const char * format, ...);
00091 void verbose_message(const char * format, ...);
00092
00093 #endif