aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/utilities/debug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/vm/utilities/debug.cpp')
-rw-r--r--src/share/vm/utilities/debug.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/share/vm/utilities/debug.cpp b/src/share/vm/utilities/debug.cpp
index 1062b525f..31d13f794 100644
--- a/src/share/vm/utilities/debug.cpp
+++ b/src/share/vm/utilities/debug.cpp
@@ -314,8 +314,8 @@ bool is_error_reported() {
#ifndef PRODUCT
#include <signal.h>
-void test_error_handler(size_t test_num)
-{
+void test_error_handler() {
+ uintx test_num = ErrorHandlerTest;
if (test_num == 0) return;
// If asserts are disabled, use the corresponding guarantee instead.
@@ -327,6 +327,8 @@ void test_error_handler(size_t test_num)
const char* const eol = os::line_separator();
const char* const msg = "this message should be truncated during formatting";
+ char * const dataPtr = NULL; // bad data pointer
+ const void (*funcPtr)(void) = (const void(*)()) 0xF; // bad function pointer
// Keep this in sync with test/runtime/6888954/vmerrors.sh.
switch (n) {
@@ -348,11 +350,16 @@ void test_error_handler(size_t test_num)
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);
-
- default: ShouldNotReachHere();
+ // There's no guarantee the bad data pointer will crash us
+ // so "break" out to the ShouldNotReachHere().
+ case 12: *dataPtr = '\0'; break;
+ // There's no guarantee the bad function pointer will crash us
+ // so "break" out to the ShouldNotReachHere().
+ case 13: (*funcPtr)(); break;
+
+ default: tty->print_cr("ERROR: %d: unexpected test_num value.", n);
}
+ ShouldNotReachHere();
}
#endif // !PRODUCT