/* Copyright (C) 1992, 1993, 1994, 1997, 1998, 1999, 2000, 2003, 2004, 2005,
- 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GDB.
int
valid_task_id (int task_num)
{
+ ada_build_task_list (0);
return (task_num > 0
&& task_num <= VEC_length (ada_task_info_s, task_list));
}
if (ada_tasks_check_symbol_table)
{
- struct symbol *sym;
struct minimal_symbol *msym;
msym = lookup_minimal_symbol (KNOWN_TASKS_NAME, NULL, NULL);
task_info = VEC_index (ada_task_info_s, task_list, taskno - 1);
/* Print the Ada task ID. */
- printf_filtered (_("Ada Task: %s\n"), paddr_nz (task_info->task_id));
+ printf_filtered (_("Ada Task: %s\n"),
+ paddress (target_gdbarch, task_info->task_id));
/* Print the name of the task. */
if (task_info->name[0] != '\0')
to the thread list. */
target_find_new_threads ();
+ /* Verify that the ptid of the task we want to switch to is valid
+ (in other words, a ptid that GDB knows about). Otherwise, we will
+ cause an assertion failure later on, when we try to determine
+ the ptid associated thread_info data. We should normally never
+ encounter such an error, but the wrong ptid can actually easily be
+ computed if target_get_ada_task_ptid has not been implemented for
+ our target (yet). Rather than cause an assertion error in that case,
+ it's nicer for the user to just refuse to perform the task switch. */
+ if (!find_thread_ptid (task_info->ptid))
+ error (_("Unable to compute thread ID for task %d.\n"
+ "Cannot switch to this task."),
+ taskno);
+
switch_to_thread (task_info->ptid);
ada_find_printable_frame (get_selected_frame (NULL));
printf_filtered (_("[Switching to task %d]\n"), taskno);