hotspot/src/share/vm/utilities/debug.hpp
changeset 37113 5a33bf5089ac
parent 33142 399fdb935d28
child 38254 05e46b580b4e
equal deleted inserted replaced
37111:98572401ab0a 37113:5a33bf5089ac
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   135 // When the status is not what is expected it is very useful to know
   135 // When the status is not what is expected it is very useful to know
   136 // what status was actually returned, so we pass the status variable as
   136 // what status was actually returned, so we pass the status variable as
   137 // an extra arg and use strerror to convert it to a meaningful string
   137 // an extra arg and use strerror to convert it to a meaningful string
   138 // like "Invalid argument", "out of memory" etc
   138 // like "Invalid argument", "out of memory" etc
   139 #define vmassert_status(p, status, msg) \
   139 #define vmassert_status(p, status, msg) \
   140   vmassert(p, "error %s(%d), %s", strerror(status), status, msg)
   140 do {                                                                           \
       
   141   if (!(p)) {                                                                  \
       
   142     report_vm_status_error(__FILE__, __LINE__, "assert(" #p ") failed",        \
       
   143                            status, msg);                                       \
       
   144     BREAKPOINT;                                                                \
       
   145   }                                                                            \
       
   146 } while (0)
   141 
   147 
   142 // For backward compatibility.
   148 // For backward compatibility.
   143 #define assert_status(p, status, msg) vmassert_status(p, status, msg)
   149 #define assert_status(p, status, msg) vmassert_status(p, status, msg)
   144 
   150 
   145 // guarantee is like vmassert except it's always executed -- use it for
   151 // guarantee is like vmassert except it's always executed -- use it for
   207 #else
   213 #else
   208 // GCC < 4.8 warns because of empty format string.  Warning can not be switched off selectively.
   214 // GCC < 4.8 warns because of empty format string.  Warning can not be switched off selectively.
   209 void report_vm_error(const char* file, int line, const char* error_msg,
   215 void report_vm_error(const char* file, int line, const char* error_msg,
   210                      const char* detail_fmt, ...);
   216                      const char* detail_fmt, ...);
   211 #endif
   217 #endif
       
   218 void report_vm_status_error(const char* file, int line, const char* error_msg,
       
   219                             int status, const char* detail);
   212 void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4);
   220 void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4);
   213 void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type,
   221 void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type,
   214                              const char* detail_fmt, ...) ATTRIBUTE_PRINTF(5, 6);
   222                              const char* detail_fmt, ...) ATTRIBUTE_PRINTF(5, 6);
   215 void report_should_not_call(const char* file, int line);
   223 void report_should_not_call(const char* file, int line);
   216 void report_should_not_reach_here(const char* file, int line);
   224 void report_should_not_reach_here(const char* file, int line);