Java Tools Tutorials - Herong's Tutorial Notes - Version 5.32, by Dr. Herong Yang
Debugging the Main Thread of a Multi-Thread Application
This section provides a tutorial example on how to debug the main thread of a multi-thread application.
4. Going back to the main thread:
Thread-0[1] stop at PrimeNumberSeeker:19 Set breakpoint PrimeNumberSeeker:19 Thread-0[1] cont > Breakpoint hit: "thread=main", PrimeNumberSeeker.main(), line=19 bci=25 19 System.out.println( i+", "+t.current+", "+t.count); main[1] where all main: [1] PrimeNumberSeeker.main (PrimeNumberSeeker.java:19) Thread-0: [1] java.lang.Thread.sleep (native method) [2] PrimeNumberSeeker.run (PrimeNumberSeeker.java:42) main[1] print i i = 11 main[1] print t.current t.current = 3 main[1] print t.count t.count = 1
What I have done here:
Last update: 2015.
Table of Contents
'javac' - The Java Program Compiler
'java' - The Java Program Launcher
'jdb' - Java Debugger Command and Options
Starting a Debugging Session with 'jdb'
Debugging Applications with Separate 'jdb' Sessions
Debugging Java Applications Remotely
Listing Debugging Commands with 'help' Command
PrimeNumberSeeker.java - Multi-Thread Sample Program
Starting Debugging Session on a Multi-Thread Application
Stepping through Statements of a Child Thread
Checking Variable Values in a Debugging Session
►Debugging the Main Thread of a Multi-Thread Application
Switching Execution Threads in a Debugging Session
Suspending Main Thread to Debug Child Thread
'jconsole' - Java Monitoring and Management Console
'jstat' - JVM Statistics Monitoring Tool
jvisualvm (Java VisualVM) - JVM Visual Tool
'javap' - The Java Class File Disassembler
'keytool' - Public Key Certificate Tool