Starting Debugging Session on a Multi-Thread Application

This section provides a tutorial example on how to start a debugging session on a multi-thread Java application,

1. Setting up breakpoints and getting the debugging session going:

C:\herong>jdb PrimeNumberSeeker

Initializing jdb ...
> stop in PrimeNumberSeeker.main
Deferring breakpoint PrimeNumberSeeker.main.
It will be set after the class is loaded.

> run
run PrimeNumberSeeker
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
VM Started: Set deferred breakpoint PrimeNumberSeeker.main

Breakpoint hit: "thread=main", PrimeNumberSeeker.main(), line=13 
13          System.out.println("Period, Current int, # primes");

main[1] stop in
Set breakpoint

main[1] cont
Period, Current int, # primes
1, 2, 0
Breakpoint hit: "thread=Thread-0",, line=28
28          primes = new int[ceiling];

Thread-0[1] threads
Group system:
  (java.lang.ref.Reference$ReferenceHandler)0x157 Reference Handler...
  (java.lang.ref.Finalizer$FinalizerThread)0x156  Finalizer        ...
  (java.lang.Thread)0x155                         Signal Dispatcher...
  (java.lang.Thread)0x154                         Attach Listener  ...
Group main:
  (java.lang.Thread)0x1         main              sleeping
  (PrimeNumberSeeker)0x189      Thread-0          running (breakpoint)

Ok. What I have done so far:

Last update: 2015.

Table of Contents

 About This Book

 Java Tools Terminology

 Installing Java 8 on Windows

 'javac' - The Java Program Compiler

 'java' - The Java Program Launcher

'jdb' - The Java Debugger

 '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 - 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

 JVM Troubleshooting Tools

 jvisualvm (Java VisualVM) - JVM Visual Tool

 'jar' - The JAR File Tool

 'javap' - The Java Class File Disassembler

 'keytool' - Public Key Certificate Tool

 'native2ascii' - Native-to-ASCII Encoding Converter

 Outdated Tutorials


 PDF Printing Version