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

need to initialize lastpc field in Java stack frames

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.1.5
    • 1.1.4
    • core-svc
    • None
    • 1.1.5
    • generic
    • generic
    • Verified

      The current debug agent uses the following code to determine whether a thread
      is suspended at a breakpoint:

      if ((thread_ee != 0) && (thread_ee->current_frame != 0) &&
                  (thread_ee->current_frame->lastpc != 0) &&
      (*thread_ee->current_frame->lastpc == opc_breakpoint)) {
      return sun_tools_debug_AgentConstants_THR_STATUS_BREAK;
      }

      However, the VM does not initialize the lastpc field to 0. If the
      debug agent happens to suspend a thread between the time when a new
      frame is pushed on the stack and the time when the first bytecode for
      the corresponding method is interpreted, the code above is likely
      to crash the VM.

      I fixed this in the Java WorkShop version of the VM by initializing
      the lastpc field every time a new frame is pushed on the stack. The
      only negative effect of this change is a slight increase in the method
      invocation time. Since the code is already initializing many other
      fields, the cost of initializing one more field should be minimal.

      robert.wilson@Eng 1997-09-26

      john.bui@eng 1997-10-17

      No specific test case available. Implicity tested, closed with exposure.

            rfield Robert Field (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: