0

I have a javaagent that performs some code instrumentation. That of course changes the stack trace for the user, whenever they perform:

new Exception().printStackTrace()

And it also affects other services Throwable.class provides:

getStackDepth()
getStackElement(int i)

Etc...

My instrumentation involves adding a new method in some cases. The method has a very unique prefix, and I would like to ignore it, if possible.

Is that in any way supported by JVMTI?

Or do I need to instrument all of the ways in which the actual java developer using the agent can get a stacktrace / stackelements / stackdepth / etc...

user967710
  • 1,815
  • 3
  • 32
  • 58

1 Answers1

-1

First of all, which Java are you using?

Please, check this documentation about ... StackTrace & GetMethodName

and check if you could use this to see if the getMethodName returns the prefix you use

char * request = (*jvmti)->GetMethodName
    if (strstr(request, "PREFIX") != NULL) {
        // contains
    }