Multi-target support
[deliverable/binutils-gdb.git] / gdb / ada-tasks.c
index e5504e9bd3dfcb049ef254ee32e108a29113a513..0b7a8eb4ad46378eadea684c679020c3aa1966cf 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -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);
 }
@@ -669,7 +669,7 @@ read_atcb (CORE_ADDR task_id, struct ada_task_info *task_info)
          msym = lookup_minimal_symbol_by_pc (task_id);
          if (msym.minsym)
            {
-             const char *full_name = MSYMBOL_LINKAGE_NAME (msym.minsym);
+             const char *full_name = msym.minsym->linkage_name ();
              const char *task_name = full_name;
              const char *p;
 
@@ -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 (inf, 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.  */
@@ -1340,7 +1343,7 @@ task_command_1 (const char *taskno_str, int from_tty, struct inferior *inf)
      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.  */
-  thread_info *tp = find_thread_ptid (task_info->ptid);
+  thread_info *tp = find_thread_ptid (inf, task_info->ptid);
   if (tp == NULL)
     error (_("Unable to compute thread ID for task %s.\n"
              "Cannot switch to this task."),
This page took 0.038435 seconds and 4 git commands to generate.