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

JDI: spec is inconsistent in handling of Location of native methods

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • core-svc
    • beta
    • generic, x86
    • generic, windows_nt
    • Not verified


      The JDI spec is inconsistent with regards to location() of native methods. In some places
      it claims they cannot be created (should return null). In others, it is claimed they can.

      Can:

      StackFrame.location()

        If the frame represents a native method invocation, the returned
            location indicates the class and method, but the code index will not be valid.

      Location.codeIndex()

      Returns the long representing the position within the method, or -1 if the
      method is native.

      Unspecified, but implies by virtue of being Locatable that they can:

      MethodEntryEvent
      MethodExitEvent
      AccessWatchpointEvent
      ModificationWatchpointEvent

      all of which are events which can occur in native code

      Cannot:

      Locatable.location()

            Returns the Location of this mirror, or null if there is no executable code
      associated with it. For example, abstract and native Methods will return
                null when their location method is called.

      It would severely break the interface if StackFrame.location() or the events could not return
      Location. So it is Locatable.location() that must be changed (note: it will still return
      null for abstract methods).

      Additionally then. all users of Location objects must behave correctly when encountering
      Location objects for native methods. Specifically,

      EventRequestManager.createBreakpointRequest(Location location)

      which is the only consumer of Location objects must have its spec changed so that it throws
      NativeMethodException (which is a RuntimeException) if passed a Location for a native
      method. And the related methods within Location must have their specs clarified.


      robert.field@Eng 2000-03-28

            rfield Robert Field (Inactive)
            ghirschsunw Gordon Hirsch (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: