Issues debugging java 9 from jdk 8

Egor Ushakov egor.ushakov at jetbrains.com
Wed Feb 14 14:44:50 UTC 2018


Thanks Seán!

This was discussed and accepted on serviceability-dev, you can see the 
comment by Chris Plummer below.
Reattaching the patch that was lost in forwardings.

Egor

On 14-Feb-18 15:35, Seán Coffey wrote:
> Hi Egor,
>
> thanks for raising this issue. Code reviews for any new change should 
> be carried out on the relevant development mailing list. In your case, 
> you need to start a mail thread with serviceability-dev at openjdk.java.net
>
> Once a patch is agreed, please request integration on the jdk8u-dev 
> mailing list via the standard process :
>
> http://openjdk.java.net/projects/jdk8u/approval-template.html
>
> Feel free to ping me if you have any more questions on this approach.
>
> Regards,
> Sean.
>
> On 14/02/18 11:35, Egor Ushakov wrote:
>> Hi all, re-sending this here again, sorry for repeating.
>> Can anyone in jdk8u-dev help with this?
>>
>> Thanks,
>> Egor
>>
>> On 08-Feb-18 01:44, Chris Plummer wrote:
>>> Hi Egor,
>>>
>>> [adding jdk8u-dev, which is where 8u backports are discussed]
>>>
>>> I think major.minor changed from 1.8 to 9.0, although I haven't 
>>> found the code to confirm that yet. I'm assuming this because of the 
>>> following code:
>>>
>>>     public boolean canGetModuleInfo() {
>>>         validateVM();
>>>         return versionInfo().jdwpMajor >= 9;
>>>     }
>>>
>>> Given that, your changes look correct. I'm not an 8u reviewer. 
>>> You'll need to get the official ok from someone on the 8u list.
>>>
>>> thanks,
>>>
>>> Chris
>>>
>>> On 2/5/18 7:44 AM, Egor Ushakov wrote:
>>>>
>>>> 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
>>>
>>>
>>
>

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

-------------- 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 jdk8u-dev mailing list