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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 6
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b53
    • CPU:
      generic
    • OS:
      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

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: