src/share/vm/utilities/debug.cpp
Print this page
@@ -325,10 +325,11 @@
const char* const str = "hello";
const size_t num = (size_t)os::vm_page_size();
const char* const eol = os::line_separator();
const char* const msg = "this message should be truncated during formatting";
+ const void (*funcPtr)(void) = (const void(*)()) 0xF; // bad function pointer
// Keep this in sync with test/runtime/6888954/vmerrors.sh.
switch (n) {
case 1: assert(str == NULL, "expected null");
case 2: assert(num == 1023 && *str == 'X',
@@ -346,15 +347,20 @@
msg, eol, msg, eol, msg, eol, msg, eol, msg));
case 8: vm_exit_out_of_memory(num, OOM_MALLOC_ERROR, "ChunkPool::allocate");
case 9: ShouldNotCallThis();
case 10: ShouldNotReachHere();
case 11: Unimplemented();
- // This is last because it does not generate an hs_err* file on Windows.
- case 12: os::signal_raise(SIGSEGV);
+ // This does not generate an hs_err* file on Windows so "break"
+ // out to the ShouldNotReachHere().
+ case 12: os::signal_raise(SIGSEGV); break;
+ // There's no guarantee the bad function pointer will crash us
+ // so "break" out to the ShouldNotReachHere().
+ case 13: (*funcPtr)(); ShouldNotReachHere(); break;
- default: ShouldNotReachHere();
+ default: tty->print_cr("ERROR: %d: unexpected test_num value.", n);
}
+ ShouldNotReachHere();
}
#endif // !PRODUCT
// ------ helper functions for debugging go here ------------