JDK-4448957 : JDI lacks ability to watch an instance's fields
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-04-20
  • Updated: 2001-04-20
  • Resolved: 2001-04-20
Related Reports
Duplicate :  
Description

Name: tb29552			Date: 04/20/2001


java version "1.3.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode)

This is a problem with JDI functionality.

EventRequestManager is only able to create WatchpointRequest's (and all of its
children classes) on ReferenceType's, and not ObjectReference's.

For instance, the spec for EventRequestManager contains the following method:
AccessWatchpointRequest createAccessWatchpointRequest(Field field)

The problem is, AccessWatchpointRequest watches accesses to field made by any
instance of the class containing field.  This makes it impossible to track the
changes to field which are made by one particular instance, since the
AccessWatchpointRequest is watching *all* instances of the class containing
field.
(Review ID: 121045) 
======================================================================

Comments
WORK AROUND Name: tb29552 Date: 04/20/2001 There is no work around for this lack of functionality short of hacking the VM. Sun needs to support this feature in the JPDA by adding methods to the com.sun.jdi.request.EventRequestManager interface; for instance, AccessWatchpointRequest createAccessWatchpointRequest( ObjectReference instance, Field field ) & ModificationWatchpointRequest createModificationWatchpointRequest( ObjectReference instance, Field field ) This ObjectReference would uniquely identify the instance which is to be watched. These methods should not replace the current ones, only accompany them. JPDA developers should be able to set watchpoints on all instances of a class, as well as particular instances. Microsoft's C# language permits developers to add this feature to their debuggers, as do all other standard C and C++ implementations. ======================================================================
11-06-2004

EVALUATION In Merlin a more general capability has been added - instance filters. These allow watchpoints to occur only for a specific instance; but they can also be used for breakpoints, method entry/exit, and step events. Closing as dup of 4312961 - Add event filtering on object instance robert.field@Eng 2001-04-20
20-04-2001