JDK-8166184 : Fix for JDK-8152899
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2016-09-15
  • Updated: 2016-09-16
  • Resolved: 2016-09-16
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
[jdk9 522]$ /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin/java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+135-jigsaw-nightly-h5480-20160909)
Java HotSpot(

FULL OS VERSION :
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

El Capitan 10.11.6


A DESCRIPTION OF THE PROBLEM :
The ptrace call in src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m
fails to compile under XCode 7.3 fails to compile with the following error:

/Volumes/ScottBackup/Java9/jdk9/hotspot/src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m:691:21: error: 'ePtAttachDeprecated' is deprecated: PT_ATTACH is deprecated. See PT_ATTACHEXC [-Werror,-Wdeprecated-declarations]
  if ((res = ptrace(PT_ATTACH, pid, 0, 0)) < 0) {
                    ^
/usr/include/sys/ptrace.h:85:19: note: expanded from macro 'PT_ATTACH'
#define PT_ATTACH       ePtAttachDeprecated     /* trace some running process */
                        ^
/usr/include/sys/ptrace.h:71:2: note: 'ePtAttachDeprecated' has been explicitly marked deprecated here
        ePtAttachDeprecated __deprecated_enum_msg("PT_ATTACH is deprecated. See PT_ATTACHEXC") = 10
        ^
1 error generated.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run make all on the hotspot source tree

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
This diff fixes the issue for me:

diff -r a20da289f646 src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m
--- a/src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m	Thu Sep 08 21:11:53 2016 +0000
+++ b/src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m	Wed Sep 14 17:35:58 2016 -0700
@@ -688,8 +688,8 @@
 // attach to a process/thread specified by "pid"
 static bool ptrace_attach(pid_t pid) {
   int res;
-  if ((res = ptrace(PT_ATTACH, pid, 0, 0)) < 0) {
-    print_error("ptrace(PT_ATTACH, %d) failed with %d\n", pid, res);
+  if ((res = ptrace(PT_ATTACHEXC, pid, 0, 0)) < 0) {
+    print_error("ptrace(PT_ATTACHEXC, %d) failed with %d\n", pid, res);
     return false;
   } else {
     return ptrace_waitpid(pid);



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