2 Replies Latest reply on Oct 3, 2011 3:11 PM by 892015

    method parameters


      I'm usimg this code to get the local variables in case of a method entry:
                  error = jvmti->GetLocalVariableTable(method, &entryCount, &localVariableEntry);
                  if(error == JVMTI_ERROR_NONE) {
                      jvmtiLocalVariableEntry* entry = localVariableEntry;
                      for(int i = 0; i < entryCount; i++, entry++) {
                          cout << entry->signature << ":" << entry->name << endl;
                          jvmti->Deallocate(reinterpret_cast<unsigned char*>(entry->signature));
                          jvmti->Deallocate(reinterpret_cast<unsigned char*>(entry->name));
                          jvmti->Deallocate(reinterpret_cast<unsigned char*>(entry->generic_signature));
                      } // for
                      jvmti->Deallocate(reinterpret_cast<unsigned char*>(localVariableEntry));
                  } else if(error = JVMTI_ERROR_ABSENT_INFORMATION) {
                      cout << "<NO LOCAL VARIABLE INFORMATION AVAILABLE>" << endl;
                  } else {
                      cout << "<ERROR>" << endl;
                  } // if...else if...else
      Now I'm wondering how to find the method parameters in all this local variables...
      Is there a way to get obly the method parameters?

      Thank you very much and with kind regards

      Alexander Schell

      Edited by: EJP on 3/10/2011 20:24: added {noformat}
      {noformat} tags: please use them.
      Edit: Moved the first code-tag
      Edited by: user3948319 on 03.10.2011 08:02                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
        • 1. Re: method parameters
          GetArgumentsSize() returns 'via max_ptr the number of local variable slots used by the method's arguments'. So the arguments are the first N local variable slots, taking due account of their size.
          1 person found this helpful
          • 2. Re: method parameters
            Hello and thanks for the answer...

            That was my first assumption...but after running the code I got some puzzling results...here's an example:

            callbackMethodEntry: methodName=reverse methodSignature=(Ljava/util/List;)V methodGenerigPtr=(Ljava/util/List<*>;)V classSignature=Ljava/util/Collections; thread=DestroyJavaVM

            The method entered takes surely one argument - a list...but the list is not the first entry in the array which is created by calling getLocalVariableTable...so I'm a wee bit confused right now...
            I also don't understand under which circumstances the JVMTI_ERROR_ABSENT_INFORMATION error is raised...

            before I forget: Thanks for the tip with the code tags...I looked for something to mark the code but could not find it...

            With kind regards

            Alexander Schell