Issues debugging java 9 from jdk 8

Egor Ushakov egor.ushakov at jetbrains.com
Mon Feb 5 15:44:32 UTC 2018


Hi all,

in IDEA we faced an issue that when debugging java 9 process memory view 
does not work:
https://youtrack.jetbrains.com/issue/JRE-641

It seems that there's a bug in how VirtualMachineImpl.canGetInstanceInfo 
checks vm version (it does not pass jdk 9 where minor is 0):
if(versionInfo().jdwpMajor <1||
versionInfo().jdwpMinor <6){
returnfalse;
}
I've found this fixed in jdk 9 inside the fix:
http://hg.openjdk.java.net/jdk9/hs/rev/f900d5afd9c8
8142968: Module System implementation Summary: Initial integration of 
JEP 200, JEP 260, JEP 261, and JEP 282 alanb 17-Mar-16 22:04

We've applied the part of the fix into our jdk 8 fork:
https://github.com/JetBrains/jdk8u_jdk/commit/6424e2786e8adc4e012e0b7bd0cfc78ba1ab34dd

It seems reasonable to backport at least this part into openjdk 8? What 
do you think?
Maybe some other parts deserve backporting as well.
I've attached the patch just in case.

-- 
Egor Ushakov
Software Developer
JetBrains
http://www.jetbrains.com
The Drive to Develop

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20180205/0ea2b15b/attachment-0001.html>
-------------- next part --------------
Index: src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java	(revision d93beeae90a6c98a14982dffa4652235c3321307)
+++ src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java	(revision 6424e2786e8adc4e012e0b7bd0cfc78ba1ab34dd)
@@ -674,20 +674,18 @@
             versionInfo().jdwpMinor >= 6;
     }
     public boolean canGetInstanceInfo() {
-        if (versionInfo().jdwpMajor < 1 ||
-            versionInfo().jdwpMinor < 6) {
-            return false;
-        }
-        validateVM();
-        return hasNewCapabilities() &&
-            capabilitiesNew().canGetInstanceInfo;
-    }
-    public boolean canUseSourceNameFilters() {
-        if (versionInfo().jdwpMajor < 1 ||
-            versionInfo().jdwpMinor < 6) {
+        if (versionInfo().jdwpMajor > 1 ||
+            versionInfo().jdwpMinor >= 6) {
+            validateVM();
+            return hasNewCapabilities() &&
+                capabilitiesNew().canGetInstanceInfo;
+        } else {
             return false;
         }
-        return true;
+    }
+    public boolean canUseSourceNameFilters() {
+        return versionInfo().jdwpMajor > 1 ||
+            versionInfo().jdwpMinor >= 6;
     }
     public boolean canForceEarlyReturn() {
         validateVM();
@@ -703,12 +701,8 @@
             capabilitiesNew().canGetSourceDebugExtension;
     }
     public boolean canGetClassFileVersion() {
-        if ( versionInfo().jdwpMajor < 1 &&
-             versionInfo().jdwpMinor  < 6) {
-            return false;
-        } else {
-            return true;
-        }
+        return versionInfo().jdwpMajor > 1 ||
+            versionInfo().jdwpMinor >= 6;
     }
     public boolean canGetConstantPool() {
         validateVM();


More information about the serviceability-dev mailing list