41 #include "runtime/atomic.inline.hpp"
42 #include "runtime/frame.hpp"
43 #include "runtime/java.hpp"
44 #include "runtime/os.hpp"
45 #include "runtime/sharedRuntime.hpp"
46 #include "runtime/stubCodeGenerator.hpp"
47 #include "runtime/stubRoutines.hpp"
48 #include "runtime/thread.inline.hpp"
49 #include "runtime/vframe.hpp"
50 #include "runtime/vm_version.hpp"
51 #include "services/heapDumper.hpp"
52 #include "utilities/defaultStream.hpp"
53 #include "utilities/events.hpp"
54 #include "utilities/macros.hpp"
55 #include "utilities/vmError.hpp"
56
57 #if INCLUDE_TRACE
58 #include "trace/tracing.hpp"
59 #endif
60
61 #ifndef ASSERT
62 # ifdef _DEBUG
63 // NOTE: don't turn the lines below into a comment -- if you're getting
64 // a compile error here, change the settings to define ASSERT
65 ASSERT should be defined when _DEBUG is defined. It is not intended to be used for debugging
66 functions that do not slow down the system too much and thus can be left in optimized code.
67 On the other hand, the code should not be included in a production version.
68 # endif // _DEBUG
69 #endif // ASSERT
70
71
72 #ifdef _DEBUG
73 # ifndef ASSERT
74 configuration error: ASSERT must be defined in debug version
75 # endif // ASSERT
76 #endif // _DEBUG
77
78
79 #ifdef PRODUCT
80 # if -defined _DEBUG || -defined ASSERT
170 look = foundp + 1;
171 }
172 if (!match) continue;
173 }
174 // got a match!
175 if (noisy) {
176 fdStream out(defaultStream::output_fd());
177 out.print_raw("[error suppressed at ");
178 out.print_raw(base_name);
179 char buf[16];
180 jio_snprintf(buf, sizeof(buf), ":%d]", line_no);
181 out.print_raw_cr(buf);
182 } else {
183 // update 1-element cache for fast silent matches
184 last_file_name = file_name;
185 last_line_no = line_no;
186 }
187 return true;
188 }
189
190 if (!is_error_reported()) {
191 // print a friendly hint:
192 fdStream out(defaultStream::output_fd());
193 out.print_raw_cr("# To suppress the following error report, specify this argument");
194 out.print_raw ("# after -XX: or in .hotspotrc: SuppressErrorAt=");
195 out.print_raw (base_name);
196 char buf[16];
197 jio_snprintf(buf, sizeof(buf), ":%d", line_no);
198 out.print_raw_cr(buf);
199 }
200 return false;
201 }
202
203 #undef is_token_break
204
205 #else
206
207 // Place-holder for non-existent suppression check:
208 #define error_is_suppressed(file_name, line_no) (false)
209
210 #endif // !PRODUCT
245 VMError::report_and_die(Thread::current_or_null(), file, line, size, vm_err_type, detail_fmt, detail_args);
246 va_end(detail_args);
247
248 // The UseOSErrorReporting option in report_and_die() may allow a return
249 // to here. If so then we'll have to figure out how to handle it.
250 guarantee(false, "report_and_die() should not return here");
251 }
252
253 void report_should_not_call(const char* file, int line) {
254 report_vm_error(file, line, "ShouldNotCall()");
255 }
256
257 void report_should_not_reach_here(const char* file, int line) {
258 report_vm_error(file, line, "ShouldNotReachHere()");
259 }
260
261 void report_unimplemented(const char* file, int line) {
262 report_vm_error(file, line, "Unimplemented()");
263 }
264
265 void report_untested(const char* file, int line, const char* message) {
266 #ifndef PRODUCT
267 warning("Untested: %s in %s: %d\n", message, file, line);
268 #endif // !PRODUCT
269 }
270
271 void report_out_of_shared_space(SharedSpaceType shared_space) {
272 static const char* name[] = {
273 "shared read only space",
274 "shared read write space",
275 "shared miscellaneous data space",
276 "shared miscellaneous code space"
277 };
278 static const char* flag[] = {
279 "SharedReadOnlySize",
280 "SharedReadWriteSize",
281 "SharedMiscDataSize",
282 "SharedMiscCodeSize"
283 };
284
|
41 #include "runtime/atomic.inline.hpp"
42 #include "runtime/frame.hpp"
43 #include "runtime/java.hpp"
44 #include "runtime/os.hpp"
45 #include "runtime/sharedRuntime.hpp"
46 #include "runtime/stubCodeGenerator.hpp"
47 #include "runtime/stubRoutines.hpp"
48 #include "runtime/thread.inline.hpp"
49 #include "runtime/vframe.hpp"
50 #include "runtime/vm_version.hpp"
51 #include "services/heapDumper.hpp"
52 #include "utilities/defaultStream.hpp"
53 #include "utilities/events.hpp"
54 #include "utilities/macros.hpp"
55 #include "utilities/vmError.hpp"
56
57 #if INCLUDE_TRACE
58 #include "trace/tracing.hpp"
59 #endif
60
61 #include <stdio.h>
62
63 #ifndef ASSERT
64 # ifdef _DEBUG
65 // NOTE: don't turn the lines below into a comment -- if you're getting
66 // a compile error here, change the settings to define ASSERT
67 ASSERT should be defined when _DEBUG is defined. It is not intended to be used for debugging
68 functions that do not slow down the system too much and thus can be left in optimized code.
69 On the other hand, the code should not be included in a production version.
70 # endif // _DEBUG
71 #endif // ASSERT
72
73
74 #ifdef _DEBUG
75 # ifndef ASSERT
76 configuration error: ASSERT must be defined in debug version
77 # endif // ASSERT
78 #endif // _DEBUG
79
80
81 #ifdef PRODUCT
82 # if -defined _DEBUG || -defined ASSERT
172 look = foundp + 1;
173 }
174 if (!match) continue;
175 }
176 // got a match!
177 if (noisy) {
178 fdStream out(defaultStream::output_fd());
179 out.print_raw("[error suppressed at ");
180 out.print_raw(base_name);
181 char buf[16];
182 jio_snprintf(buf, sizeof(buf), ":%d]", line_no);
183 out.print_raw_cr(buf);
184 } else {
185 // update 1-element cache for fast silent matches
186 last_file_name = file_name;
187 last_line_no = line_no;
188 }
189 return true;
190 }
191
192 if (!is_error_reported() && !SuppressFatalErrorMessage) {
193 // print a friendly hint:
194 fdStream out(defaultStream::output_fd());
195 out.print_raw_cr("# To suppress the following error report, specify this argument");
196 out.print_raw ("# after -XX: or in .hotspotrc: SuppressErrorAt=");
197 out.print_raw (base_name);
198 char buf[16];
199 jio_snprintf(buf, sizeof(buf), ":%d", line_no);
200 out.print_raw_cr(buf);
201 }
202 return false;
203 }
204
205 #undef is_token_break
206
207 #else
208
209 // Place-holder for non-existent suppression check:
210 #define error_is_suppressed(file_name, line_no) (false)
211
212 #endif // !PRODUCT
247 VMError::report_and_die(Thread::current_or_null(), file, line, size, vm_err_type, detail_fmt, detail_args);
248 va_end(detail_args);
249
250 // The UseOSErrorReporting option in report_and_die() may allow a return
251 // to here. If so then we'll have to figure out how to handle it.
252 guarantee(false, "report_and_die() should not return here");
253 }
254
255 void report_should_not_call(const char* file, int line) {
256 report_vm_error(file, line, "ShouldNotCall()");
257 }
258
259 void report_should_not_reach_here(const char* file, int line) {
260 report_vm_error(file, line, "ShouldNotReachHere()");
261 }
262
263 void report_unimplemented(const char* file, int line) {
264 report_vm_error(file, line, "Unimplemented()");
265 }
266
267 #ifdef ASSERT
268 bool is_executing_unit_tests() {
269 return ExecutingUnitTests;
270 }
271
272 void report_assert_msg(const char* msg, ...) {
273 va_list ap;
274 va_start(ap, msg);
275
276 fprintf(stderr, "assert failed: %s\n", err_msg(FormatBufferDummy(), msg, ap).buffer());
277
278 va_end(ap);
279 }
280 #endif // ASSERT
281
282 void report_untested(const char* file, int line, const char* message) {
283 #ifndef PRODUCT
284 warning("Untested: %s in %s: %d\n", message, file, line);
285 #endif // !PRODUCT
286 }
287
288 void report_out_of_shared_space(SharedSpaceType shared_space) {
289 static const char* name[] = {
290 "shared read only space",
291 "shared read write space",
292 "shared miscellaneous data space",
293 "shared miscellaneous code space"
294 };
295 static const char* flag[] = {
296 "SharedReadOnlySize",
297 "SharedReadWriteSize",
298 "SharedMiscDataSize",
299 "SharedMiscCodeSize"
300 };
301
|