United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6517249 JDWP: Cannot do an invokeMethod after a popFrames operation
JDK-6517249 : JDWP: Cannot do an invokeMethod after a popFrames operation

Details
Type:
Bug
Submit Date:
2007-01-24
Status:
Resolved
Updated Date:
2010-12-08
Project Name:
JDK
Resolved Date:
2007-02-23
Component:
core-svc
OS:
generic
Sub-Component:
debugger
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:

Sub Tasks

Description
Stop at a breakpoint, do a popFrames, and then an invokeMethod.
An IncompatibleThreadStateException is thrown.

The JDI spec for invokeMethod says:

  Method invocation can occur only if the specified thread
  has been suspended by an event which occurred in that thread. 
  :
  @throws IncompatibleThreadStateException if the specified thread has not
          been suspended by an event.

It seems logical to assume that if the thread is suspended by an event
which occured in that thread, and a popFrames is done, the thread should
still be considered to be suspended by an event, and so invokeMethod should
be allowed.

                                    

Comments
SUGGESTED FIX

- fix the back-end event handler's handling of the completion of a pop to notice that 
  when the thread is resumed, an invoke is to be done instead of a normal resume

- fix the back-end to remember the state of invoke being allowed or not when a 
  popFrames operation is begun, and restore that state when the popFrames finishes.

See attached webrev.
                                     
2007-01-24
EVALUATION

When the back-end reports an event to the front-end, the thread on which the event
occurred is suspended.  If an invokeMethod command is received, the back-end
sets some special flags and resumes the suspended thread.  The suspended
thread resumes inside the event-handler which checks those special flags to see if an invoke is to be done, and if so, the event handler does the invoke instead of letting the thread resume its normal processing.

When JVM Ti completes a pop operation,  an internal step event is received by the back-end event handler.  The event handler notices that this is a special event and does some processing to complete the pop operation.  When the thread is resumed in this state, it doesn't check the special flags to see if an invoke is to be done, but just resumes normal processing.  To prevent this from happening, the back-end
generates an error which results in the IncompatibleThreadStateException being thrown  if an invokeMethod is attempted while the thread is in this state.
                                     
2007-01-24



Hardware and Software, Engineered to Work Together