Skip to content

Commit e92b9e4

Browse files
committed
8293325: Minor improvements to macos catch_mach_exception_raise() error handling
Reviewed-by: amenkov, dcubed, sspitsyn
1 parent 767262e commit e92b9e4

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m

+13-7
Original file line numberDiff line numberDiff line change
@@ -869,19 +869,25 @@ kern_return_t catch_mach_exception_raise(
869869
}
870870

871871
// This message should denote a Unix soft signal, with
872-
// 1. the exception type = EXC_SOFTWARE
873-
// 2. codes[0] (which is the code) = EXC_SOFT_SIGNAL
874-
// 3. codes[1] (which is the sub-code) = SIGSTOP
875-
if (!(exception_type == EXC_SOFTWARE &&
876-
codes[0] == EXC_SOFT_SIGNAL &&
877-
codes[num_codes -1] == SIGSTOP)) {
872+
// 1. the exception type = EXC_SOFTWARE (5)
873+
// 2. codes[0] (which is the code) = EXC_SOFT_SIGNAL (0x10003 / 65539)
874+
// 3. codes[1] (which is the sub-code) = SIGSTOP (17)
875+
if (exception_type != EXC_SOFTWARE || codes[0] != EXC_SOFT_SIGNAL) {
878876
print_error("catch_mach_exception_raise: Message doesn't denote a Unix "
879877
"soft signal. exception_type = %d, codes[0] = %d, "
880878
"codes[num_codes -1] = 0x%llx, num_codes = %d\n",
881879
exception_type, codes[0], codes[num_codes - 1], num_codes);
882880
return GOT_UNKNOWN_EXC;
883881
}
884-
return KERN_SUCCESS;
882+
int sig = codes[num_codes -1];
883+
if (sig == SIGSTOP) {
884+
return KERN_SUCCESS;
885+
} else {
886+
// Sometimes we get SIGTRAP(4) or SIGILL(5) instead of SIGSTOP (17) on aarch64.
887+
// We currently can't deal with them. See JDK-8288429.
888+
print_error("catch_mach_exception_raise: signal is not SIGSTOP (%d)\n", sig);
889+
return GOT_UNKNOWN_EXC;
890+
}
885891
}
886892

887893
kern_return_t catch_mach_exception_raise_state(

0 commit comments

Comments
 (0)