Troubleshooting
Problem
How does a IBM® Rational® VADS® user get program and task control block (TCB) information? This technote describes where to find the interfaces and how they work for getting program and task control block (TCB) information for Ada tasks in your application.
Resolving The Problem
To get access to the TCB from an application, use the types and interface routines defined in ada_krn_defs.a, ada_krn_i.a, and krn_defs.a in the standard library. Here is a snippet of code that will get the TCB:
-- Get the program control block for our executable.
current_pcb := ada_krn_i.program_get_krn_id (ada_krn_i.program_self);
-- Get a pointer to the head of our program's task control block list
current_tcb := current_pcb.t_head;
The TCB is a record type named krn_tcb_t, which is defined in krn_defs.a. Each field of the record contains information about the task.
The cpu_state field is of type cpu_state_t that is defined in krn_cpu_defs.a. This would be used to find out the address that the task will resume after being suspended or the return address.
The q_next field is for placing a task on a queue. For example, when a task waits at a condition variable, it's placed on that condition variable's queue. It's also used for the delay queue, run queue, etc.
The t_link field is a list of the active tasks in your program.
Historical Number
23624
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21125689