Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to intercept system calls in JVM?

843829Feb 11 2009 — edited Jun 25 2009
Hi, everyone. I am looking for a way to intercept system calls in JVM, a way do something like ptrace does in Linux. Because I wanna log all function calls a specified application made, and I may modify the arguments and the return value.

And then i search the internet but nothing found except this article:
[ http://java.sun.com/developer/technicalArticles/Programming/jvmti/#Authors| http://java.sun.com/developer/technicalArticles/Programming/jvmti/#Authors]

It's seems that JVMTI is a perfect tools to manipulate Java VM and i can achieve my goal with it. I download the sample code you written and modify a bit to adopt my environment (I use Linux and Sun JDK 6). It works well.

And then I add a function to get stacktrace like the case in your article. I also read the sample code in JVMIT Refenerce, but it doesn't work.

So, I am puzzled. I wanna know is there any way to intercept system calls in JVM? If JVMTI can do it, is there any tutorial or sample code to review? And, is that possible to use this way in J2ME?

Thanks a lot :)
Best Regard.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 23 2009
Added on Feb 11 2009
12 comments
1,488 views