I am thinking of creating a debug tool for my Java application.
I am wondering if it is possible to get a stack trace, just like Exception.printStackTrace()
You can get a stack trace like this:
Throwable t = new Throwable();
t.printStackTrace();
If you want to access the frame, you can use t.getStackTrace() to get an array of stack frames.
Be aware that this stacktrace (just like any other) may be missing some frames if the hotspot compiler has been busy optimizing things.