src/hotspot/share/utilities/debug.hpp
changeset 53757 e31f39e088b7
parent 53244 9807daeb47c4
child 54701 6b77693eda6a
equal deleted inserted replaced
53756:adfb1c71f52c 53757:e31f39e088b7
    52 // compiler can't handle an empty ellipsis in a macro without a warning.
    52 // compiler can't handle an empty ellipsis in a macro without a warning.
    53 #define vmassert(p, ...)                                                       \
    53 #define vmassert(p, ...)                                                       \
    54 do {                                                                           \
    54 do {                                                                           \
    55   if (!(p)) {                                                                  \
    55   if (!(p)) {                                                                  \
    56     TOUCH_ASSERT_POISON;                                                       \
    56     TOUCH_ASSERT_POISON;                                                       \
    57     if (is_executing_unit_tests()) {                                           \
       
    58       report_assert_msg(__VA_ARGS__);                                          \
       
    59     }                                                                          \
       
    60     report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", __VA_ARGS__); \
    57     report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", __VA_ARGS__); \
    61     BREAKPOINT;                                                                \
    58     BREAKPOINT;                                                                \
    62   }                                                                            \
    59   }                                                                            \
    63 } while (0)
    60 } while (0)
    64 #endif
    61 #endif
   155 void report_vm_error(const char* file, int line, const char* error_msg);
   152 void report_vm_error(const char* file, int line, const char* error_msg);
   156 #if !defined(__GNUC__) || defined (__clang_major__) || (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || __GNUC__ > 4)
   153 #if !defined(__GNUC__) || defined (__clang_major__) || (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || __GNUC__ > 4)
   157 // ATTRIBUTE_PRINTF works with gcc >= 4.8 and any other compiler.
   154 // ATTRIBUTE_PRINTF works with gcc >= 4.8 and any other compiler.
   158 void report_vm_error(const char* file, int line, const char* error_msg,
   155 void report_vm_error(const char* file, int line, const char* error_msg,
   159                      const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5);
   156                      const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5);
   160 #ifdef ASSERT
       
   161 void report_assert_msg(const char* msg, ...) ATTRIBUTE_PRINTF(1, 2);
       
   162 #endif // ASSERT
       
   163 #else
   157 #else
   164 // GCC < 4.8 warns because of empty format string.  Warning can not be switched off selectively.
   158 // GCC < 4.8 warns because of empty format string.  Warning can not be switched off selectively.
   165 void report_vm_error(const char* file, int line, const char* error_msg,
   159 void report_vm_error(const char* file, int line, const char* error_msg,
   166                      const char* detail_fmt, ...);
   160                      const char* detail_fmt, ...);
   167 #ifdef ASSERT
       
   168 void report_assert_msg(const char* msg, ...);
       
   169 #endif // ASSERT
       
   170 #endif
   161 #endif
   171 void report_vm_status_error(const char* file, int line, const char* error_msg,
   162 void report_vm_status_error(const char* file, int line, const char* error_msg,
   172                             int status, const char* detail);
   163                             int status, const char* detail);
   173 void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4);
   164 void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4);
   174 void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type,
   165 void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type,
   175                              const char* detail_fmt, ...) ATTRIBUTE_PRINTF(5, 6);
   166                              const char* detail_fmt, ...) ATTRIBUTE_PRINTF(5, 6);
   176 void report_should_not_call(const char* file, int line);
   167 void report_should_not_call(const char* file, int line);
   177 void report_should_not_reach_here(const char* file, int line);
   168 void report_should_not_reach_here(const char* file, int line);
   178 void report_unimplemented(const char* file, int line);
   169 void report_unimplemented(const char* file, int line);
   179 void report_untested(const char* file, int line, const char* message);
   170 void report_untested(const char* file, int line, const char* message);
   180 
       
   181 #ifdef ASSERT
       
   182 // unit test support
       
   183 bool is_executing_unit_tests();
       
   184 #endif // ASSERT
       
   185 
   171 
   186 void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2);
   172 void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2);
   187 
   173 
   188 // Compile-time asserts.  Cond must be a compile-time constant expression that
   174 // Compile-time asserts.  Cond must be a compile-time constant expression that
   189 // is convertible to bool.  STATIC_ASSERT() can be used anywhere a declaration
   175 // is convertible to bool.  STATIC_ASSERT() can be used anywhere a declaration