pre/post method call interceptor for every java method without java code change

Balázs Galambos balazs.galambos at gmail.com
Wed May 11 03:09:25 PDT 2011


Hello

I am trying to modify current stack trace creation and exception
handling of java.( to make Thread.dumpthreads more informative.)
I am looking for the point where the a new stacktraceelement is put
into the stack trace when a method is executed, and where it is
removed after finishing with it. I want to create a pre method
interceptor and a post method interceptor, that are called for every
method it finds during execution, without having to change all my java
source. In these interceptors I want to add some extra info to the
stack trace.

I think the answer is somewhere in JVM hotspot.
javaCallWrapper seems to do what I need, but I cannot find where is
the point when it adds/removes stack trace info.

I have found some constructors of stack trace elements are located in
javaClasses.cpp (java_lang_Throwable::fill_in_stack_trace..) but I am
not sure which one is used.

can you help me in this questions?

Thanks for your help!
Balazs


More information about the hotspot-dev mailing list