diff options
Diffstat (limited to 'gdb/ada-tasks.c')
-rw-r--r-- | gdb/ada-tasks.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 110a710..67aa0c7 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -347,7 +347,7 @@ valid_task_id (int task_num) task state. */ static int -ada_task_is_alive (struct ada_task_info *task_info) +ada_task_is_alive (const struct ada_task_info *task_info) { return (task_info->state != Terminated); } @@ -1127,14 +1127,17 @@ print_ada_task_info (struct ui_out *uiout, /* Print the associated Thread ID. */ if (uiout->is_mi_like_p ()) { - thread_info *thread = find_thread_ptid (task_info->ptid); + thread_info *thread = (ada_task_is_alive (task_info) + ? find_thread_ptid (task_info->ptid) + : nullptr); if (thread != NULL) uiout->field_signed ("thread-id", thread->global_num); else - /* This should never happen unless there is a bug somewhere, - but be resilient when that happens. */ - uiout->field_skip ("thread-id"); + { + /* This can happen if the thread is no longer alive. */ + uiout->field_skip ("thread-id"); + } } /* Print the ID of the parent task. */ |