From 5e7b5f74c234fb11db064df93e309463a9058740 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Thu, 23 Apr 2009 18:55:20 +0000 Subject: [PATCH] * ada-tasks (task_command_1): Call target_find_new_threads. --- gdb/ChangeLog | 4 ++++ gdb/ada-tasks.c | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a6917cb059e..ec17070d71c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2009-04-23 Joel Brobecker + + * ada-tasks (task_command_1): Call target_find_new_threads. + 2009-04-23 Joel Brobecker * stack.c (do_gdb_disassembly): Print the exception message if an diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index f7bbf2dff90..14f2503f874 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -865,6 +865,15 @@ task_command_1 (char *taskno_str, int from_tty) if (!ada_task_is_alive (task_info)) error (_("Cannot switch to task %d: Task is no longer running"), taskno); + /* On some platforms, the thread list is not updated until the user + performs a thread-related operation (by using the "info threads" + command, for instance). So this thread list may not be up to date + when the user attempts this task switch. Since we cannot switch + to the thread associated to our task if GDB does not know about + that thread, we need to make sure that any new threads gets added + to the thread list. */ + target_find_new_threads (); + switch_to_thread (task_info->ptid); ada_find_printable_frame (get_selected_frame (NULL)); printf_filtered (_("[Switching to task %d]\n"), taskno); -- 2.30.2