return (task_info->state != Terminated);
}
+/* Call the ITERATOR function once for each Ada task that hasn't been
+ terminated yet. */
+
+void
+iterate_over_live_ada_tasks (ada_task_list_iterator_ftype *iterator)
+{
+ int i, nb_tasks;
+ struct ada_task_info *task;
+
+ ada_build_task_list (0);
+ nb_tasks = VEC_length (ada_task_info_s, task_list);
+
+ for (i = 0; i < nb_tasks; i++)
+ {
+ task = VEC_index (ada_task_info_s, task_list, i);
+ if (!ada_task_is_alive (task))
+ continue;
+ iterator (task);
+ }
+}
+
/* Extract the contents of the value as a string whose length is LENGTH,
and store the result in DEST. */
if (ada_tasks_check_symbol_table)
{
- struct symbol *sym;
struct minimal_symbol *msym;
msym = lookup_minimal_symbol (KNOWN_TASKS_NAME, NULL, NULL);
const char *private_data_name = "system__task_primitives__private_data";
const char *entry_call_record_name = "system__tasking__entry_call_record";
+ /* ATCB symbols may be found in several compilation units. As we
+ are only interested in one instance, use standard (literal,
+ C-like) lookups to get the first match. */
+
struct symbol *atcb_sym =
- lookup_symbol (atcb_name, NULL, VAR_DOMAIN, NULL);
+ lookup_symbol_in_language (atcb_name, NULL, VAR_DOMAIN,
+ language_c, NULL);
const struct symbol *common_atcb_sym =
- lookup_symbol (common_atcb_name, NULL, VAR_DOMAIN, NULL);
+ lookup_symbol_in_language (common_atcb_name, NULL, VAR_DOMAIN,
+ language_c, NULL);
const struct symbol *private_data_sym =
- lookup_symbol (private_data_name, NULL, VAR_DOMAIN, NULL);
+ lookup_symbol_in_language (private_data_name, NULL, VAR_DOMAIN,
+ language_c, NULL);
const struct symbol *entry_call_record_sym =
- lookup_symbol (entry_call_record_name, NULL, VAR_DOMAIN, NULL);
+ lookup_symbol_in_language (entry_call_record_name, NULL, VAR_DOMAIN,
+ language_c, NULL);
if (atcb_sym == NULL || atcb_sym->type == NULL)
{
/* In Ravenscar run-time libs, the ATCB does not have a dynamic
size, so the symbol name differs. */
- atcb_sym = lookup_symbol (atcb_name_fixed, NULL, VAR_DOMAIN, NULL);
+ atcb_sym = lookup_symbol_in_language (atcb_name_fixed, NULL, VAR_DOMAIN,
+ language_c, NULL);
if (atcb_sym == NULL || atcb_sym->type == NULL)
error (_("Cannot find Ada_Task_Control_Block type. Aborting"));
}
}
- /* And finally, compute the task ptid. */
-
- if (ada_task_is_alive (task_info))
+ /* And finally, compute the task ptid. Note that there are situations
+ where this cannot be determined:
+ - The task is no longer alive - the ptid is irrelevant;
+ - We are debugging a core file - the thread is not always
+ completely preserved for us to link back a task to its
+ underlying thread. Since we do not support task switching
+ when debugging core files anyway, we don't need to compute
+ that task ptid.
+ In either case, we don't need that ptid, and it is just good enough
+ to set it to null_ptid. */
+
+ if (target_has_execution && ada_task_is_alive (task_info))
task_info->ptid = ptid_from_atcb_common (common_value);
else
task_info->ptid = null_ptid;