< prev index next >

src/share/vm/utilities/debug.cpp

Print this page
rev 10991 : 8149591: Prepare hotspot for GTest
Contributed-by: stefan.karlsson@oracle.com, stefan.sarne@oracle.com, jesper.wilhelmsson@oracle.com
Reviewed-by: duke

@@ -56,10 +56,12 @@
 
 #if INCLUDE_TRACE
 #include "trace/tracing.hpp"
 #endif
 
+#include <stdio.h>
+
 #ifndef ASSERT
 #  ifdef _DEBUG
    // NOTE: don't turn the lines below into a comment -- if you're getting
    // a compile error here, change the settings to define ASSERT
    ASSERT should be defined when _DEBUG is defined.  It is not intended to be used for debugging

@@ -185,11 +187,11 @@
       last_line_no   = line_no;
     }
     return true;
   }
 
-  if (!is_error_reported()) {
+  if (!is_error_reported() && !SuppressFatalErrorMessage) {
     // print a friendly hint:
     fdStream out(defaultStream::output_fd());
     out.print_raw_cr("# To suppress the following error report, specify this argument");
     out.print_raw   ("# after -XX: or in .hotspotrc:  SuppressErrorAt=");
     out.print_raw   (base_name);

@@ -260,10 +262,25 @@
 
 void report_unimplemented(const char* file, int line) {
   report_vm_error(file, line, "Unimplemented()");
 }
 
+#ifdef ASSERT
+bool is_executing_unit_tests() {
+  return ExecutingUnitTests;
+}
+
+void report_assert_msg(const char* msg, ...) {
+  va_list ap;
+  va_start(ap, msg);
+
+  fprintf(stderr, "assert failed: %s\n", err_msg(FormatBufferDummy(), msg, ap).buffer());
+
+  va_end(ap);
+}
+#endif // ASSERT
+
 void report_untested(const char* file, int line, const char* message) {
 #ifndef PRODUCT
   warning("Untested: %s in %s: %d\n", message, file, line);
 #endif // !PRODUCT
 }
< prev index next >