diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 51e946f702..8b45cf6a15 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -6965,3 +6965,18 @@ version-control: never
 coding: utf-8
 End:
 
+2019-05-18  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+	* gdbthread.h (thread_target_id_str): Declare.
+	* thread.c (thread_target_id_str): Make non static.
+	(add_thread_with_info): Use thread_target_id_str instead of
+	target_pid_to_str.
+	(thr_try_catch_cmd): Likewise.
+	* procfs.c (procfs_target::wait): Likewise.
+	* linux-nat.c (exit_lwp): Likewise.
+	* infrun.c (normal_stop): Likewise.
+	* fbsd-nat.c (fbsd_nat_target::wait): Likewise.
+	* gdb/ada-tasks.c (display_current_task_id): Print task name.
+	(task_command_1): Likewise.
+	* NEWS: Announce that thread and task names are now shown at
+	more places.
diff --git a/gdb/NEWS b/gdb/NEWS
index 1e92a2b52c..0f835fd486 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -19,6 +19,10 @@
 * Two new convernience functions $_cimag and $_creal that extract the
   imaginary and real parts respectively from complex numbers.
 
+* GDB now shows thread names at more places, e.g. in messages announcing
+  the new threads.  GDB also shows the Ada task names at more places,
+  e.g. in task switching messages.
+
 * Python API
 
   ** The gdb.Value type has a new method 'format_string' which returns a
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 9c07f0ca22..61163b1399 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1255,7 +1255,17 @@ display_current_task_id (void)
   if (current_task == 0)
     printf_filtered (_("[Current task is unknown]\n"));
   else
-    printf_filtered (_("[Current task is %d]\n"), current_task);
+    {
+      struct ada_tasks_inferior_data *data
+	= get_ada_tasks_inferior_data (current_inferior ());
+      struct ada_task_info *task_info = &data->task_list[current_task - 1];
+
+      if (task_info->name[0] == '\0')
+	printf_filtered (_("[Current task is %d]\n"), current_task);
+      else
+	printf_filtered (_("[Current task is %d %s]\n"),
+			 current_task, task_info->name);
+    }
 }
 
 /* Parse and evaluate TIDSTR into a task id, and try to switch to
@@ -1301,7 +1311,11 @@ task_command_1 (const char *taskno_str, int from_tty, struct inferior *inf)
 
   switch_to_thread (tp);
   ada_find_printable_frame (get_selected_frame (NULL));
-  printf_filtered (_("[Switching to task %d]\n"), taskno);
+  if (task_info->name[0] == '\0')
+    printf_filtered (_("[Switching to task %d]\n"), taskno);
+  else
+    printf_filtered (_("[Switching to task %d %s]\n"),
+		     taskno, task_info->name);
   print_stack_frame (get_selected_frame (NULL),
                      frame_relative_level (get_selected_frame (NULL)),
 		     SRC_AND_LOC, 1);
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 55dab15fca..a86ba3ecec 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -12855,3 +12855,8 @@ fill-column: 74
 version-control: never
 coding: utf-8
 End:
+
+2019-05-18  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+	* gdb.texinfo (Ada Tasks): Tell the task name is printed, update
+	examples.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 37e2f14ad0..9de56061d9 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -17250,7 +17250,7 @@ State: Runnable
 @item task
 @kindex task@r{ (Ada)}
 @cindex current Ada task ID
-This command prints the ID of the current task.
+This command prints the ID and name of the current task.
 
 @smallexample
 @iftex
@@ -17259,9 +17259,9 @@ This command prints the ID of the current task.
 (@value{GDBP}) info tasks
   ID       TID P-ID Pri State                  Name
    1   8077870    0  15 Child Activation Wait  main_task
-*  2   807c458    1  15 Runnable               t
+*  2   807c458    1  15 Runnable               some_task
 (@value{GDBP}) task
-[Current task is 2]
+[Current task is 2 some_task]
 @end smallexample
 
 @item task @var{taskno}
@@ -17277,9 +17277,9 @@ from the current task to the given task.
 (@value{GDBP}) info tasks
   ID       TID P-ID Pri State                  Name
    1   8077870    0  15 Child Activation Wait  main_task
-*  2   807c458    1  15 Runnable               t
+*  2   807c458    1  15 Runnable               some_task
 (@value{GDBP}) task 1
-[Switching to task 1]
+[Switching to task 1 some_task]
 #0  0x8067726 in pthread_cond_wait ()
 (@value{GDBP}) bt
 #0  0x8067726 in pthread_cond_wait ()
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index d4f4c8cf35..99ea79b02a 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -1348,7 +1348,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 					pl.pl_lwpid);
 		  if (print_thread_events)
 		    printf_unfiltered (_("[%s exited]\n"),
-				       target_pid_to_str (wptid).c_str ());
+				       thread_target_id_str (thr).c_str ());
 		  delete_thread (thr);
 		}
 	      if (ptrace (PT_CONTINUE, pid, (caddr_t) 1, 0) == -1)
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index ffd4bf5c82..88ffeaaa38 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -763,4 +763,10 @@ extern void print_selected_thread_frame (struct ui_out *uiout,
    alive anymore.  */
 extern void thread_select (const char *tidstr, class thread_info *thr);
 
+/* Return the string to display e.g. in "info threads"'s "Target Id"
+   column, for TP.  */
+
+std::string
+thread_target_id_str (thread_info *tp);
+
 #endif /* GDBTHREAD_H */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 37df561de0..88d54cffe7 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -7989,7 +7989,7 @@ normal_stop (void)
 	{
 	  target_terminal::ours_for_output ();
 	  printf_filtered (_("[Switching to %s]\n"),
-			   target_pid_to_str (inferior_ptid).c_str ());
+			   thread_target_id_str (inferior_thread ()).c_str ());
 	  annotate_thread_changed ();
 	}
       previous_inferior_ptid = inferior_ptid;
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 65165a2d46..8446f2aa89 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1014,7 +1014,7 @@ exit_lwp (struct lwp_info *lp)
     {
       if (print_thread_events)
 	printf_unfiltered (_("[%s exited]\n"),
-			   target_pid_to_str (lp->ptid).c_str ());
+			   thread_target_id_str (th).c_str ());
 
       delete_thread (th);
     }
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 020336e5ba..242d6571aa 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -2284,8 +2284,12 @@ wait_again:
 		if (syscall_is_lwp_exit (pi, what))
 		  {
 		    if (print_thread_events)
-		      printf_unfiltered (_("[%s exited]\n"),
-					 target_pid_to_str (retval).c_str ());
+		      {
+			thread_info *thr = find_thread_ptid (retval);
+
+			printf_unfiltered (_("[%s exited]\n"),
+					   thread_target_id_str (thr).c_str ());
+		      }
 		    delete_thread (find_thread_ptid (retval));
 		    status->kind = TARGET_WAITKIND_SPURIOUS;
 		    return retval;
@@ -2405,8 +2409,12 @@ wait_again:
 		else if (syscall_is_lwp_exit (pi, what))
 		  {
 		    if (print_thread_events)
-		      printf_unfiltered (_("[%s exited]\n"),
-					 target_pid_to_str (retval).c_str ());
+		      {
+			thread_info *thr = find_thread_ptid (retval);
+
+			printf_unfiltered (_("[%s exited]\n"),
+					   thread_target_id_str (thr).c_str ());
+		      }
 		    delete_thread (find_thread_ptid (retval));
 		    status->kind = TARGET_WAITKIND_SPURIOUS;
 		    return retval;
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5cfad2754e..96a80277eb 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -16053,3 +16053,11 @@ For older changes see ChangeLog-1993-2013.
     Copyright 2014-2019 Free Software Foundation, Inc.
   Copying and distribution of this file, with or without modification,
   are permitted provided the copyright notice and this notice are preserved.
+
+2019-05-18  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+	* gdb./threads/multiple-successive-infcall.exp: Update to match
+	thread name.
+	* gdb.ada/rdv_wait.exp: Update to match task name.
+	gdb.ada/task_switch_in_core.exp: Likewise.
+
diff --git a/gdb/testsuite/gdb.ada/rdv_wait.exp b/gdb/testsuite/gdb.ada/rdv_wait.exp
index c0c4e29f5f..fa309a1341 100644
--- a/gdb/testsuite/gdb.ada/rdv_wait.exp
+++ b/gdb/testsuite/gdb.ada/rdv_wait.exp
@@ -31,5 +31,5 @@ runto "break_me"
 # Switch to task 2, and verify that GDB is able to unwind all the way
 # to foo.T.
 gdb_test "task 2" \
-         [join {"\\\[Switching to task 2\\\].*" \
+         [join {"\\\[Switching to task 2 mit\\\].*" \
                 ".*foo\\.t \\(.*\\).*foo\\.adb:.*"} ""]
diff --git a/gdb/testsuite/gdb.ada/task_switch_in_core.exp b/gdb/testsuite/gdb.ada/task_switch_in_core.exp
index 4c482834bc..f0ac8dbc98 100644
--- a/gdb/testsuite/gdb.ada/task_switch_in_core.exp
+++ b/gdb/testsuite/gdb.ada/task_switch_in_core.exp
@@ -71,7 +71,7 @@ gdb_test "info tasks" \
 # we will verify right after with an additional test that the current
 # task is now task 2.
 gdb_test "task 2" \
-         "\\\[Switching to task 2\\\].*"
+         "\\\[Switching to task 2 my_t\\\].*"
 
 gdb_test "info tasks" \
          [multi_line "\\s+ID\\s+TID\\s+P-ID\\s+Pri\\s+State\\s+Name" \
diff --git a/gdb/testsuite/gdb.threads/multiple-successive-infcall.exp b/gdb/testsuite/gdb.threads/multiple-successive-infcall.exp
index e17c265616..cc99bf30ef 100644
--- a/gdb/testsuite/gdb.threads/multiple-successive-infcall.exp
+++ b/gdb/testsuite/gdb.threads/multiple-successive-infcall.exp
@@ -42,7 +42,7 @@ gdb_continue_to_breakpoint "prethreadcreationmarker"
 set after_new_thread_message "created new thread"
 foreach_with_prefix thread {5 4 3}  {
   gdb_test_multiple "continue" "${after_new_thread_message}" {
-    -re "\\\[New Thread ${hex} \\\(LWP \[0-9\]+\\\)\\\].*${gdb_prompt}" {
+    -re "\\\[New Thread ${hex} \\\(LWP \[0-9\]+\\\).*\\\].*${gdb_prompt}" {
       pass "${after_new_thread_message}"
     }
   }
diff --git a/gdb/thread.c b/gdb/thread.c
index 9a6a773595..baa3d528e9 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -319,7 +319,7 @@ add_thread_with_info (ptid_t ptid, private_thread_info *priv)
   result->priv.reset (priv);
 
   if (print_thread_events)
-    printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid).c_str ());
+    printf_unfiltered (_("[New %s]\n"), thread_target_id_str (result).c_str ());
 
   annotate_new_thread ();
   return result;
@@ -986,10 +986,9 @@ should_print_thread (const char *requested_threads, int default_inf_num,
   return 1;
 }
 
-/* Return the string to display in "info threads"'s "Target Id"
-   column, for TP.  */
+/* See gdbthread.h.  */
 
-static std::string
+std::string
 thread_target_id_str (thread_info *tp)
 {
   std::string target_id = target_pid_to_str (tp->ptid);
@@ -1469,7 +1468,7 @@ thr_try_catch_cmd (thread_info *thr, const char *cmd, int from_tty,
 	  if (!flags.quiet)
 	    printf_filtered (_("\nThread %s (%s):\n"),
 			     print_thread_id (thr),
-			     target_pid_to_str (inferior_ptid).c_str ());
+			     thread_target_id_str (thr).c_str ());
 	  printf_filtered ("%s", cmd_result.c_str ());
 	}
     }
@@ -1480,7 +1479,7 @@ thr_try_catch_cmd (thread_info *thr, const char *cmd, int from_tty,
 	  if (!flags.quiet)
 	    printf_filtered (_("\nThread %s (%s):\n"),
 			     print_thread_id (thr),
-			     target_pid_to_str (inferior_ptid).c_str ());
+			     thread_target_id_str (thr).c_str ());
 	  if (flags.cont)
 	    printf_filtered ("%s\n", ex.what ());
 	  else
@@ -1826,7 +1825,7 @@ print_selected_thread_frame (struct ui_out *uiout,
 	  uiout->text ("[Switching to thread ");
 	  uiout->field_string ("new-thread-id", print_thread_id (tp));
 	  uiout->text (" (");
-	  uiout->text (target_pid_to_str (inferior_ptid).c_str ());
+	  uiout->text (thread_target_id_str (tp).c_str ());
 	  uiout->text (")]");
 	}
     }
