Automatic date update in version.in
[deliverable/binutils-gdb.git] / gdb / ada-tasks.c
index e4a52976dcb791ff5d5d2527188d8713531a7487..67aa0c798890aae65c5bbada9635f157ac040681 100644 (file)
@@ -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);
 }
@@ -604,7 +604,7 @@ ptid_from_atcb_common (struct value *common_value)
 }
 
 /* Read the ATCB data of a given task given its TASK_ID (which is in practice
-   the address of its assocated ATCB record), and store the result inside
+   the address of its associated ATCB record), and store the result inside
    TASK_INFO.  */
 
 static void
@@ -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;
 
@@ -744,7 +744,7 @@ read_atcb (CORE_ADDR task_id, struct ada_task_info *task_info)
                                        called_task_fieldno));
     }
 
-  /* If the ATCB cotnains some information about RV callers, then
+  /* If the ATCB contains some information about RV callers, then
      compute the "caller_task".  Otherwise, leave it as zero.  */
 
   if (pspace_data->atcb_fieldno.call >= 0)
@@ -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.  */
This page took 0.024668 seconds and 4 git commands to generate.