+ if (common_atcb_sym == NULL || common_atcb_sym->type == NULL)
+ error (_("Cannot find Common_ATCB type. Aborting"));
+ if (private_data_sym == NULL || private_data_sym->type == NULL)
+ error (_("Cannot find Private_Data type. Aborting"));
+ if (entry_call_record_sym == NULL || entry_call_record_sym->type == NULL)
+ error (_("Cannot find Entry_Call_Record type. Aborting"));
+
+ /* Get the type for Ada_Task_Control_Block.Common. */
+ common_type = common_atcb_sym->type;
+
+ /* Get the type for Ada_Task_Control_Bloc.Common.Call.LL. */
+ ll_type = private_data_sym->type;
+
+ /* Get the type for Common_ATCB.Call.all. */
+ call_type = entry_call_record_sym->type;
+
+ /* Get the field indices. */
+ fieldnos.common = ada_get_field_index (type, "common", 0);
+ fieldnos.entry_calls = ada_get_field_index (type, "entry_calls", 1);
+ fieldnos.atc_nesting_level =
+ ada_get_field_index (type, "atc_nesting_level", 1);
+ fieldnos.state = ada_get_field_index (common_type, "state", 0);
+ fieldnos.parent = ada_get_field_index (common_type, "parent", 1);
+ fieldnos.priority = ada_get_field_index (common_type, "base_priority", 0);
+ fieldnos.image = ada_get_field_index (common_type, "task_image", 1);
+ fieldnos.image_len = ada_get_field_index (common_type, "task_image_len", 1);
+ fieldnos.activation_link = ada_get_field_index (common_type,
+ "activation_link", 1);
+ fieldnos.call = ada_get_field_index (common_type, "call", 1);
+ fieldnos.ll = ada_get_field_index (common_type, "ll", 0);
+ fieldnos.ll_thread = ada_get_field_index (ll_type, "thread", 0);
+ fieldnos.ll_lwp = ada_get_field_index (ll_type, "lwp", 1);
+ fieldnos.call_self = ada_get_field_index (call_type, "self", 0);
+
+ /* On certain platforms such as x86-windows, the "lwp" field has been
+ named "thread_id". This field will likely be renamed in the future,
+ but we need to support both possibilities to avoid an unnecessary
+ dependency on a recent compiler. We therefore try locating the
+ "thread_id" field in place of the "lwp" field if we did not find
+ the latter. */
+ if (fieldnos.ll_lwp < 0)
+ fieldnos.ll_lwp = ada_get_field_index (ll_type, "thread_id", 1);
+
+ /* Set all the out parameters all at once, now that we are certain
+ that there are no potential error() anymore. */
+ pspace_data = get_ada_tasks_pspace_data (current_program_space);
+ pspace_data->initialized_p = 1;
+ pspace_data->atcb_type = type;
+ pspace_data->atcb_common_type = common_type;
+ pspace_data->atcb_ll_type = ll_type;
+ pspace_data->atcb_call_type = call_type;
+ pspace_data->atcb_fieldno = fieldnos;