00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #define DEBUG_EXCEPTION _asm { int 3 }
00025
00026
00027 #ifdef PRODUCT
00028 #define FILE_INFO "<no file info>"
00029 #define LINE_INFO 0
00030 #else
00031 #define FILE_INFO __FILE__
00032 #define LINE_INFO __LINE__
00033 #endif
00034
00035
00036 #ifdef ASSERT
00037 #define assert(b,msg) \
00038 if (!(b)) { \
00039 report_assertion_failure(XSTR(b),FILE_INFO, LINE_INFO, msg); \
00040 DEBUG_EXCEPTION; \
00041 }
00042 #else
00043 #define assert(b,msg)
00044 #endif
00045
00046
00047 #define fatal(m) { report_fatal(FILE_INFO, LINE_INFO, m ); DEBUG_EXCEPTION; }
00048 #define fatal1(m,x1) { report_fatal(FILE_INFO, LINE_INFO, m, x1 ); DEBUG_EXCEPTION; }
00049 #define fatal2(m,x1,x2) { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2 ); DEBUG_EXCEPTION; }
00050 #define fatal3(m,x1,x2,x3) { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3 ); DEBUG_EXCEPTION; }
00051 #define fatal4(m,x1,x2,x3,x4) { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3, x4 ); DEBUG_EXCEPTION; }
00052 #define fatal5(m,x1,x2,x3,x4,x5) { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3, x4, x5 ); DEBUG_EXCEPTION; }
00053 #define fatal6(m,x1,x2,x3,x4,x5,x6) { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3, x4, x5, x6 ); DEBUG_EXCEPTION; }
00054 #define fatal7(m,x1,x2,x3,x4,x5,x6,x7) { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3, x4, x5, x6, x7 ); DEBUG_EXCEPTION; }
00055 #define fatal8(m,x1,x2,x3,x4,x5,x6,x7,x8) { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3, x4, x5, x6, x7, x8 ); DEBUG_EXCEPTION; }
00056 #define fatal9(m,x1,x2,x3,x4,x5,x6,x7,x8,x9) { report_fatal(FILE_INFO, LINE_INFO, m, x1, x2, x3, x4, x5, x6, x7, x8, x9); DEBUG_EXCEPTION; }
00057
00058
00059 #define guarantee(b,msg) { if (!(b)) fatal(msg); }
00060 #define ShouldNotCallThis() { report_should_not_call (FILE_INFO, LINE_INFO); DEBUG_EXCEPTION; }
00061 #define ShouldNotReachHere() { report_should_not_reach_here (FILE_INFO, LINE_INFO); DEBUG_EXCEPTION; }
00062 #define SubclassResponsibility() { report_subclass_responsibility(FILE_INFO, LINE_INFO); DEBUG_EXCEPTION; }
00063 #define Unimplemented() { report_unimplemented (FILE_INFO, LINE_INFO); DEBUG_EXCEPTION; }
00064
00065
00066 void report_assertion_failure(char* code_str, char* file_name, int line_no, char* message);
00067 void report_fatal(char* file_name, int line_no, char* format, ...);
00068 void report_should_not_call(char* file_name, int line_no);
00069 void report_should_not_reach_here(char* file_name, int line_no);
00070 void report_subclass_responsibility(char* file_name, int line_no);
00071 void report_unimplemented(char* file_name, int line_no);
00072 void report_vm_state();
00073
00074
00075 extern "C" {
00076 void breakpoint();
00077 void error_breakpoint();
00078 }