3 Replies Latest reply: Jan 7, 2010 9:32 PM by 843810 RSS

    how to get object id which include the method with a method ID

    843810
      I am writing a jvmti code to obtain a joined thread id.
      To get the id, I made METHOD_EXIT event enable to get a method ID of join method.
      But, I have a serious problem.

      I can not get object id which include the method of a method ID at METHOD_EXIT event.

      Give me your advices, please.

      Thanks in advance.
        • 1. Re: how to get object id which include the method with a method ID
          800575
          The JVM TI method exit event contains a jthread for the thread on which the method ran:
          http://java.sun.com/javase/6/docs/platform/jvmti/jvmti.html#MethodExit

          Recall that during execution of a method, 'this' resides in slot 0 of the stack frame,
          so all you have to do is use GetLocalObject to get the value of slot 0 from depth 0:
          http://java.sun.com/javase/6/docs/platform/jvmti/jvmti.html#GetLocalObject

          I presume this is what you want.
          - jjh
          • 2. Re: how to get object id which include the method with a method ID
            843810
            Your reply gave me a new insight to JVMTI.

            I deeply appreciate your kindness.

            I thought it is possible to get the object executed by the current thread,
            but it was not until I saw your message that I found where the object is.

            I still have some difficulties to understand JVMTI.
            Frankly, I don't know what the parameters depth and slot of GetLocalObject function mean.

            Could you give me some references for understanding JVMTI more well?

            Thanks.

            Edited by: bcKim on Jan 15, 2008 6:45 PM
            • 3. Re: how to get object id which include the method with a method ID
              843810
              hello,
              I saw your solution. It is quite useful! You solve how to get the methodID when methodexit+ event happend. While my problem is how to get methodID when methodentry+ event happened in JVMTI.
              Wating for you reply and thx so much~