I tried to find online, but didn't find answer. Usually we debug a Java program by breaking at some line of the application.
I want to know is there a way to debug a Java program by breaking at the entry point of JVM itself?
For example, to run a simple Java program, we can do:
java Foo
My question is, how can we debug what's going into JVM (by invoking java) before our class is loaded? Is there some way to achieve this?
process launch -sinlldbto see code that runs beforemainin a C program. However, I doubt it will help debug any issues related to memory or hanging threads in your application, since suspend-on-start covers even static initializersgdb --args java Fooprovided that you use a JDK which have debug information (OpenJDK). For everything else - e.g. monitoring the application - why not using a profiler like YourKit?