Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4705586

JDI: ObjectReference.invokeMethod() with INVOKE_NONVIRTUAL works unstable

XMLWordPrintable

    • generic
    • generic

      nvokeMethod.DummySuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and without the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummyClass: longProtMeth invoked
      CHECK PASSED: the invoked method returns: 9223372036854775807 as expected


      1) Trying to invoke the method "longMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperClass.longMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummySuperClass: longMeth invoked
      CHECK PASSED: the method invoked with ObjectReference.INVOKE_NONVIRTUAL returns: 9223372036854775806 as expected

      2) Trying to invoke the method "longMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperClass.longMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and without the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummyClass: longMeth invoked
      CHECK PASSED: the invoked method returns: 9223372036854775807 as expected


      1) Trying to invoke the method "longProtMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass.longProtMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummySuperSuperClass: longProtMeth invoked
      CHECK PASSED: the method invoked with ObjectReference.INVOKE_NONVIRTUAL returns: 9223372036854775805 as expected

      2) Trying to invoke the method "longProtMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass.longProtMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and without the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummyClass: longProtMeth invoked
      CHECK PASSED: the invoked method returns: 9223372036854775807 as expected


      1) Trying to invoke the method "longMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass.longMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummySuperSuperClass: longMeth invoked
      CHECK PASSED: the method invoked with ObjectReference.INVOKE_NONVIRTUAL returns: 9223372036854775805 as expected

      2) Trying to invoke the method "longMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass.longMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and without the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummyClass: longMeth invoked
      CHECK PASSED: the invoked method returns: 9223372036854775807 as expected

      Debuggee process finished with the status: 95
      exit code = 95
      ---------------------------------------------------------------------------

      The test will be available in release r15 of the testbase_nsk.
      ======================================================================


      Name: egR10015 Date: 06/20/2002



      HotSpot 1.4.1-b14 fails to pass the following test:

      nsk/jdi/ObjectReference/invokeMethod/invokemethod008

      from testbase_nsk on all platforms. Non-virtual invocation mode (setting
      by the ObjectReference.INVOKE_NONVIRTUAL flag) does not work, if the JDI
      method com.sun.jdi.ObjectReference.invokeMethod() is called second time,
      being previously invoked in default virtual invocation mode (without the
      flag).

      The mentioned test checks that virtual and non-virtual method invocation
      will be performed properly. It consists of two part: debugger (the file
      invokemethod008.java) and debuggee (invokemethod008t.java).
      The debugger invokes debuggee methods "longMeth", "longProtMeth" which
      are overriden in an object reference of class "DummyClass", but obtained
      from a reference type of its superclass "DummySuperClass" and
      then from the supersuperclass "DummySuperSuperClass". The JDI method is
      invoked without and with the flag INVOKE_NONVIRTUAL sequentially. It is
      expected, that methods from the object reference class instead of from
      the superclass will be invoked without the flag and vise versa otherwise.

      The first virtual invocation is performed properly, the overriden
      debuggee method is invoked as expected. But sequential non-virtual one
      is not: the overriden debuggee method is invoked again instead of
      specified non-overridden one.

      I've noticed that, if the first virtual invocation is commented out
      (see the file invokemethod008.java.pass1), or non-virtual invocation is
      performed _before_ the virtual one (see invokemethod008.java.pass2), the
      modified test starts to pass. Please note also that number of superclasses
      and therefore, number of overriding of a method, does not matter, only
      the order of virtual and non-virtual invocations.

      To reproduce the bug run with HS1.4.1

      sh doit.sh $JAVA_HOME

      in

      /net/sqesvr.sfbay/export/vsn/GammaBase/Bugs/<this bug number>

      where JAVA_HOME should point to jdk1.4.1

      ----------------- output on Solsparc with HS 1.4.1-b14: -------------------
      $ sh doit.sh ~/hotspot/jdk1.4.1/solsparc
      Compiling support classes...
      Note: share/Status.java uses or overrides a deprecated API.
      Note: Recompile with -deprecation for details.
      Compiling the test classes...
      java version "1.4.1-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14)
      Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode)

      Executing the test ...
      binder> VirtualMachineManager: version 1.4
      binder> Finding connector: default
      binder> LaunchingConnector:
      binder> name: com.sun.jdi.CommandLineLaunch
      binder> description: Launches target using Sun Java VM command line and attaches to it
      binder> transport: dt_socket
      binder> Connector arguments:
      binder> home=/export/ld55/java/dest/jdk1.4.1-b14/solaris-sparc/jre
      binder> vmexec=java
      binder> options=
      binder> main=nsk.jdi.ObjectReference.invokeMethod.invokemethod008t -verbose "-waittime=1"
      binder> quote="
      binder> suspend=true
      binder> Launching debugee
      created breakpoint request nsk.jdi.ObjectReference.invokeMethod.invokemethod008t:48 (disabled)
      for class nsk.jdi.ObjectReference.invokeMethod.invokemethod008t (loaded by instance of sun.misc.Launcher$AppClassLoader(id=202))
      ; line=48

      Starting potential timed out section:
      waiting 1 minute(s) for JDI Breakpoint event ...

      following JDI event occured: VMStartEvent in thread invokemethod008tThr
      expected Breakpoint event occured: ###@###.###kemethod008t:48 in thread
      invokemethod008tThr

      Potential timed out section successfully passed



      1) Trying to invoke the method "longProtMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperClass.longProtMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and without the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummyClass: longProtMeth invoked
      CHECK PASSED: the invoked method returns: 9223372036854775807 as expected

      2) Trying to invoke the method "longProtMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperClass.longProtMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummyClass: longProtMeth invoked
      # ERROR: TEST FAILED: wrong non-virtual invocation: the method "longProtMeth (J)J"
      # ERROR: got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      # ERROR: invoked with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL"
      # ERROR: using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)",
      # ERROR: returns: 9223372036854775807 instead of 9223372036854775806 as expected


      1) Trying to invoke the method "longMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperClass.longMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and without the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummyClass: longMeth invoked
      CHECK PASSED: the invoked method returns: 9223372036854775807 as expected

      2) Trying to invoke the method "longMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperClass.longMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummyClass: longMeth invoked
      # ERROR: TEST FAILED: wrong non-virtual invocation: the method "longMeth (J)J"
      # ERROR: got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      # ERROR: invoked with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL"
      # ERROR: using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)",
      # ERROR: returns: 9223372036854775807 instead of 9223372036854775806 as expected


      1) Trying to invoke the method "longProtMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass.longProtMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and without the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummyClass: longProtMeth invoked
      CHECK PASSED: the invoked method returns: 9223372036854775807 as expected

      2) Trying to invoke the method "longProtMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass.longProtMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummyClass: longProtMeth invoked
      # ERROR: TEST FAILED: wrong non-virtual invocation: the method "longProtMeth (J)J"
      # ERROR: got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      # ERROR: invoked with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL"
      # ERROR: using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)",
      # ERROR: returns: 9223372036854775807 instead of 9223372036854775805 as expected


      1) Trying to invoke the method "longMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass.longMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and without the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummyClass: longMeth invoked
      CHECK PASSED: the invoked method returns: 9223372036854775807 as expected

      2) Trying to invoke the method "longMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass.longMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummyClass: longMeth invoked
      # ERROR: TEST FAILED: wrong non-virtual invocation: the method "longMeth (J)J"
      # ERROR: got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      # ERROR: invoked with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL"
      # ERROR: using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)",
      # ERROR: returns: 9223372036854775807 instead of 9223372036854775805 as expected

      Debuggee process finished with the status: 95


      #>
      #> SUMMARY: Following errors occured
      #> during test execution:
      #>
      # ERROR: TEST FAILED: wrong non-virtual invocation: the method "longProtMeth (J)J"
      # ERROR: got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      # ERROR: invoked with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL"
      # ERROR: using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)",
      # ERROR: returns: 9223372036854775807 instead of 9223372036854775806 as expected
      # ERROR: TEST FAILED: wrong non-virtual invocation: the method "longMeth (J)J"
      # ERROR: got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      # ERROR: invoked with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL"
      # ERROR: using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)",
      # ERROR: returns: 9223372036854775807 instead of 9223372036854775806 as expected
      # ERROR: TEST FAILED: wrong non-virtual invocation: the method "longProtMeth (J)J"
      # ERROR: got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      # ERROR: invoked with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL"
      # ERROR: using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)",
      # ERROR: returns: 9223372036854775807 instead of 9223372036854775805 as expected
      # ERROR: TEST FAILED: wrong non-virtual invocation: the method "longMeth (J)J"
      # ERROR: got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperSuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      # ERROR: invoked with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL"
      # ERROR: using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)",
      # ERROR: returns: 9223372036854775807 instead of 9223372036854775805 as expected
      exit code = 97
      ---------------------------------------------------------------------------

      Here is log of the modified test invokemethod008.java.pass2 mentioned
      above which passes:
      ---------------------------------------------------------------------------
      binder> VirtualMachineManager: version 1.4
      binder> Finding connector: default
      binder> LaunchingConnector:
      binder> name: com.sun.jdi.CommandLineLaunch
      binder> description: Launches target using Sun Java VM command line and attaches to it
      binder> transport: dt_socket
      binder> Connector arguments:
      binder> home=/export/ld55/java/dest/jdk1.4.1-b14/solaris-sparc/jre
      binder> vmexec=java
      binder> options=
      binder> main=nsk.jdi.ObjectReference.invokeMethod.invokemethod008t -verbose "-waittime=1"
      binder> quote="
      binder> suspend=true
      binder> Launching debugee
      created breakpoint request nsk.jdi.ObjectReference.invokeMethod.invokemethod008t:48 (disabled)
      for class nsk.jdi.ObjectReference.invokeMethod.invokemethod008t (loaded by instance of sun.misc.Launcher$AppClassLoader(id=202))
      ; line=48

      Starting potential timed out section:
      waiting 1 minute(s) for JDI Breakpoint event ...

      following JDI event occured: VMStartEvent in thread invokemethod008tThr
      expected Breakpoint event occured: ###@###.###kemethod008t:48 in thread
      invokemethod008tThr

      Potential timed out section successfully passed



      1) Trying to invoke the method "longProtMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperClass.longProtMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.invokeMethod.DummySuperClass (loaded by instance of
      sun.misc.Launcher$AppClassLoader(id=202))"
      with the arguments: [9223372036854775807] and with the flag ObjectReference.INVOKE_NONVIRTUAL
      using the debuggee object reference "instance of nsk.jdi.ObjectReference.invokeMethod.DummyClass(id=204)" ...
      debugee.stderr> DummySuperClass: longProtMeth invoked
      CHECK PASSED: the method invoked with ObjectReference.INVOKE_NONVIRTUAL returns: 9223372036854775806 as expected

      2) Trying to invoke the method "longProtMeth (J)J nsk.jdi.ObjectReference.invokeMethod.DummySuperClass.longProtMeth(long)"
      got from reference type "class nsk.jdi.ObjectReference.i

            Unassigned Unassigned
            eugsunw Eug Eug (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: