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

TTY: pointer to current thread frame is not updated after 'pop'

XMLWordPrintable

    • mantis
    • generic
    • generic
    • Verified



      Name: dkR10014 Date: 04/04/2002


      The following testbase_nsk test:
         nsk/jdb/pop/pop001
      fails on all platforms (Solsparc, Solx86, Win, Linux) in all debugged VM mode.

      There are two files in the test:
        pop001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb
      output,
        pop001a.java - the debugged application.

      The test checks jdb's 'pop' command and works as follows.
      The debugged application (pop001a.java) starts additional thread of MyThread
      class. The 'run()' method of the this class invokes recursively a number of
      int methods. The jdb sets breakpoint in the last called 'func5()' method
      to stop the debugged VM when all the methods, i.e. from 'func1()' to
      'func5()', are in MyThread's stack. Then jdb steps up three frame on the stack
      by 'up 3' command. At this moment frame with 'func2()' is current.
      Then the 'pop' command is called. The test passes if after 'pop' command
      the 'func1()' frame becomes current and jdb correctly reports the thread stack
      and local variable(s) of the current frame.

      But the jdb prompt shows that after 'pop' command pointer to current thread
      frame is not
      updated. This leads to erroneus result for subsequent 'where' and 'locals'
      commands:
      ...
      MyThread[4] pop
      MyThread[4] where
      MyThread[4] locals
      Internal exception:
      MyThread[4]
      ...

      The following error message is printed in jdb stderr stream:
      java.lang.IndexOutOfBoundsException
      at
      com.sun.tools.jdi.ThreadReferenceImpl.isSubrange(ThreadReferenceImpl.java:294)
      at
      com.sun.tools.jdi.ThreadReferenceImpl.privateFrames(ThreadReferenceImpl.java:323
      )
      at
      com.sun.tools.jdi.ThreadReferenceImpl.frame(ThreadReferenceImpl.java:276)
      at
      com.sun.tools.example.debug.tty.ThreadInfo.getCurrentFrame(ThreadInfo.java:233)
      at
      com.sun.tools.example.debug.tty.Commands.commandLocals(Commands.java:1424)
      at com.sun.tools.example.debug.tty.TTY.executeCommand(TTY.java:247)
      at com.sun.tools.example.debug.tty.TTY.<init>(TTY.java:539)
      at com.sun.tools.example.debug.tty.TTY.main(TTY.java:830)

      Test error message:
      # ERROR: Contents of stack trace is incorrect after 'pop' command
      # ERROR: Searched for: nsk.jdb.pop.MyThread.func1
      # ERROR: Count : 0
      # ERROR: Internal exception was thrown while 'locals' command
      # ERROR: Internal exception:
      # ERROR: MyThread[4]
      # ERROR: TEST FAILED

      Below is test jdb stdout log redirected to jdb.stdout file:
      ------------------------------------------------------------------
      Initializing jdb ...
      >
      <<COMMAND>>stop in nsk.jdb.pop.pop001a.main

      Deferring breakpoint nsk.jdb.pop.pop001a.main.
      It will be set after the class is loaded.
      >
      <<COMMAND>>run

      run nsk.jdb.pop.pop001a
      >
      VM Started: Set deferred breakpoint nsk.jdb.pop.pop001a.main

      Breakpoint hit: "thread=main", nsk.jdb.pop.pop001a.main(), line=21 bci=0

      main[1]
      <<COMMAND>>stop in nsk.jdb.pop.pop001a.lastBreak

      Set breakpoint nsk.jdb.pop.pop001a.lastBreak
      main[1]
      <<COMMAND>>cont

      > run() started
      func1() started
      func2() started
      func3() started
      func4() started
      func5() started

      Breakpoint hit: "thread=MyThread", nsk.jdb.pop.pop001a.lastBreak(), line=24
      bci=0

      MyThread[1]
      <<COMMAND>>threads

      Group system:
        (java.lang.ref.Reference$ReferenceHandler)0x105 Reference Handler cond.
      waiting
        (java.lang.ref.Finalizer$FinalizerThread)0x104 Finalizer cond.
      waiting
        (java.lang.Thread)0x103 Signal Dispatcher running
      Group main:
        (java.lang.Thread)0x1 main cond.
      waiting
        (java.util.logging.LogManager$Cleaner)0x151 Thread-0 unknown
        (nsk.share.Finalizer$FinalizerThread)0x152 Thread-1 unknown
        (nsk.jdb.pop.MyThread)0x14e MyThread running (at
      breakpoint)
      MyThread[1]
      <<COMMAND>>thread 0x14e

      MyThread[1]
      <<COMMAND>>step

      >
      Step completed: "thread=MyThread", nsk.jdb.pop.MyThread.func5(), line=93 bci=14

      MyThread[1]
      <<COMMAND>>where

        [1] nsk.jdb.pop.MyThread.func5 (pop001a.java:93)
        [2] nsk.jdb.pop.MyThread.func4 (pop001a.java:85)
        [3] nsk.jdb.pop.MyThread.func3 (pop001a.java:78)
        [4] nsk.jdb.pop.MyThread.func2 (pop001a.java:71)
        [5] nsk.jdb.pop.MyThread.func1 (pop001a.java:64)
        [6] nsk.jdb.pop.MyThread.run (pop001a.java:56)
      MyThread[1]
      <<COMMAND>>up 3

      MyThread[4]
      <<COMMAND>>where

        [4] nsk.jdb.pop.MyThread.func2 (pop001a.java:71)
        [5] nsk.jdb.pop.MyThread.func1 (pop001a.java:64)
        [6] nsk.jdb.pop.MyThread.run (pop001a.java:56)
      MyThread[4]
      <<COMMAND>>pop

      MyThread[4]
      <<COMMAND>>where

      MyThread[4]
      <<COMMAND>>locals

      Internal exception:
      MyThread[4]
      <<COMMAND>>cont

      func2() started
      func3() started
      func4() started
      func5() started
      >
      Breakpoint hit: "thread=MyThread", nsk.jdb.pop.pop001a.lastBreak(), line=24
      bci=0

      MyThread[1]
      <<COMMAND>>cont

      > run() finished

      The application exited
      ------------------------------------------------------------------
      <<COMMAND>> prefix designates input commands.
         
      How to reproduce:
       1. cd /net/sqesvr.sfbay/export/vsn/GammaBase/Bugs/{this_bug_number}
       2. sh doit.sh <JAVA_HOME>

      The test will appear in the next testbase_nsk r13 relase.

      ======================================================================

            duke J. Duke
            kdossunw Kdos Kdos (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: