JDK-8166246 : More general fix for JDK-8152899
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2016-09-16
  • Updated: 2016-09-19
  • Resolved: 2016-09-19
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
[hotspot 827]$ java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+135-jigsaw-nightly-h5480-20160909)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+135-jigsaw-nightly-h5480-2

FULL OS VERSION :
[hotspot 826]$ uname -a
Darwin Scotts-iMac.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64

10.11.6


A DESCRIPTION OF THE PROBLEM :
After looking at when the change to deprecate the PT_ATTACH flag for ptrace(2) was introduced, I have come up with a more general path that allows the MacosxDebuggerLocal.m code to compile under Xcode 7.3 and earlier by simple redefine the PT_ATTACH value to PT_ATTACHEXC when PT_ATTACHEXC is seen to be defined.

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
[hotspot 825]$ hg diff -g
diff --git a/src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m b/src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m
--- a/src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m
+++ b/src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m
@@ -54,6 +54,12 @@
 #error UNSUPPORTED_ARCH
 #endif
 
+// Redefine PT_ATTACH as PT_ATTACHEXC if PT_ATTACHEXC exists
+#ifdef PT_ATTACHEXC
+#undef PT_ATTACH
+#define PT_ATTACH PT_ATTACHEXC
+#endif
+
 static jfieldID symbolicatorID = 0; // set in _init0
 static jfieldID taskID = 0; // set in _init0
 


Comments
Submitter has provided patch for JDK-8152899 closing as duplicate of JDK-8152899 and updated issue with patch details
19-09-2016