ChorusOS 5.0 Debugging Guide

Working With Threads

In a GDB debugging session, threads have two numbers: a ChorusOS thread number and a GDB number. Both numbers are unique. The GDB thread number is never reused, unlike the ChorusOS thread number.

The standard command to list threads is info threads:


(chgdb) info threads
3 Thread 13 (Thread_13)  sampleThread () at 
			root_dir/system-int/opt/examples/progov/timers.c:81 
2 Thread 14 (Thread_14)  sampleThread () at 
			root_dir/system-int/opt/examples/progov/timers.c:81 
* 1 Thread 11 (main)  main (argc=1, argv=0xeffd2008, envp=0xeffd2010) at 
			root_dir/system-int/opt/examples/progov/timers.c:169 

(chgdb) 

In the preceding example, the numbers in the first column (3, 2 and 1) are the GDB thread numbers. The numbers in the second column (13, 14 and 11) are the ChorusOS thread numbers.

To change the current thread, use the thread gdb_thread_number command.

In an application debugging session, you can use the info rdbthreads command to obtain additional information about threads:


(chgdb) info rdbthreads
NUMBER  STATE  CURRENT  PRIO  TOTTIME  INTTIME  NAME 
14      Run             140      0        0     Thread_14 
13      Run             140      0        0     Thread_13 
11      Run        *    140      0        0     main

Because this command is provided by the debug server, it displays ChorusOS thread numbers only. In the preceding example, the number under the NUMBER column is the ChorusOS thread number and the name in the NAME column (Thread_x) is the ChorusOS thread name.

Use the rdbthread chorusos_thread_number command to change the current thread.