Examining Threads

In some operating systems, a single program may have more than one thread of execution. The precise semantics of threads differ from one operating system to another, but in general the threads of a single program are akin to multiple processes--except that they share one address space (that is, they can all examine and modify the same variables). On the other hand, each thread has its own registers and execution stack, and perhaps private memory.

For debugging purposes, DDD lets you display the list of threads currently active in your program and lets you select the current thread--the thread which is the focus of debugging. DDD shows all program information from the perspective of the current thread.26

PICS/ddd-threads.jpg

To view all currently active threads in your program, select Status => Threads. The current thread is highlighted. Select any thread to make it the current thread.

Using JDB, additional functionality is available:

  • Select a thread group to switch between viewing all threads and the threads of the selected thread group;
  • Click on Suspend to suspend execution of the selected threads;
  • Click on Resume to resume execution of the selected threads.

For more information on threads, see the JDB and GDB documentation (see Debugging programs with multiple threads).

Node:Signals, Next:Killing the Program, Previous:Threads, Up:Running

results matching ""

    No results matching ""