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

First static field watchpoint is missed if the class is not prepared

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 6
    • 5.0
    • hotspot
    • b53
    • generic
    • solaris_9

    Description

      If you put a watchpoint on a static variable and access it directly from
      another class, the first time the variable is accessed, the watchpoint won't
      stop. This is because the class prepare event is not being fired until after
      the line with the access is passed. This is not a problem when the variable
      is not static and subsequence accesses work fine.

      -------------------------------
      I was easily able to reproduce the problem with JDB using the attached classes. Here is the session:

      C:\Documents and Settings\dsomerfi\watchpoint_test>jdb TestMain
      Initializing jdb ...
      > watch Skippable._skiparroo
      Deferring watch modification of Skippable._skiparroo.
      It will be set after the class is loaded.
      > run
      run TestMain
      Set uncaught java.lang.Throwable
      Set deferred uncaught java.lang.Throwable
      >
      VM Started: Set deferred watch modification of Skippable._skiparroo
      0
      0

      The application exited

      C:\Documents and Settings\dsomerfi\watchpoint_test>jdb TestMain
      Initializing jdb ...
      > watch access Skippable._skiparroo
      Deferring watch accesses of Skippable._skiparroo.
      It will be set after the class is loaded.
      > run
      run TestMain
      Set uncaught java.lang.Throwable
      Set deferred uncaught java.lang.Throwable
      >
      VM Started: Set deferred watch accesses of Skippable._skiparroo
      0

      Field (Skippable._skiparroo) access encountered: "thread=main", TestMain.useInne
      r(), line=13 bci=12
      13 System.out.println(Skippable._skiparroo);

      main[1]

      Notice that it stops on line 13. That is the second access to _skiparroo. It should be stopping on line
      12 first.
       
      ---------------------

      Attachments

        Activity

          People

            sspitsyn Serguei Spitsyn
            cprasadsunw Ck Prasad (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: