Next: , Previous: Ada Exceptions, Up: Running and Debugging Ada Programs


30.8 Ada Tasks

GDB allows the following task-related commands:

info tasks
This command shows a list of current Ada tasks, as in the following example:
          (gdb) info tasks
            ID       TID P-ID   Thread Pri State                 Name
             1   8088000   0   807e000  15 Child Activation Wait main_task
             2   80a4000   1   80ae000  15 Accept/Select Wait    b
             3   809a800   1   80a4800  15 Child Activation Wait a
          *  4   80ae800   3   80b8000  15 Running               c

In this listing, the asterisk before the first task indicates it to be the currently running task. The first column lists the task ID that is used to refer to tasks in the following commands.

break linespec task taskid
break linespec task taskid if ...
These commands are like the break ... thread .... linespec specifies source lines.

Use the qualifier ‘task taskid’ with a breakpoint command to specify that you only want GDB to stop the program when a particular Ada task reaches this breakpoint. taskid is one of the numeric task identifiers assigned by GDB, shown in the first column of the ‘info tasks’ display.

If you do not specify ‘task taskid’ when you set a breakpoint, the breakpoint applies to all tasks of your program.

You can use the task qualifier on conditional breakpoints as well; in this case, place ‘task taskid’ before the breakpoint condition (before the if).

task taskno
This command allows to switch to the task referred by taskno. In particular, This allows to browse the backtrace of the specified task. It is advised to switch back to the original task before continuing execution otherwise the scheduling of the program may be perturbed.

For more detailed information on the tasking support, see Debugging with GDB.