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 wantGDB
to stop the program when a particular Ada task reaches this breakpoint. `taskid' is one of the numeric task identifiers assigned byGDB
, shown in the first column of theinfo 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, placetask `taskid'
before the breakpoint condition (before theif
).
task `taskno'
This command allows switching to the task referred by `taskno'. In particular, this allows browsing of the backtrace of the specified task. It is advisable 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.