Patchwork [RFAv2] Output the Ada task name in more messages, output task names between "".

login
register
mail settings
Submitter Philippe Waroquiers
Date Aug. 4, 2019, 3:10 p.m.
Message ID <20190804151051.3356-1-philippe.waroquiers@skynet.be>
Download mbox | patch
Permalink /patch/33955/
State New
Headers show

Comments

Philippe Waroquiers - Aug. 4, 2019, 3:10 p.m.
With this patch, we e.g. get:
      [Switching to task 2 "task_list(1)"]
      [Current task is 2 "task_list(1)"]
    instead of
      [Switching to task 2]
      [Current task is 2]

The logic to produce the taskno optionally followed
by the task name has been factorized in the task_to_str function.

Also, task names are output between double quotes, similarly to what GDB
does for thread names.

Also, improves the alignement of 'info tasks' output.
With this patch, we get:
      (gdb) info task
         ID           TID P-ID Pri State                  Name
      *   1  555555759030       48 Runnable               "main_task"
          2  555555759e30    1  48 Selective Wait         "mit"
      (gdb)
   instead of
      (gdb) info task
         ID       TID P-ID Pri State                  Name
      *   1 555555759030       48 Runnable               main_task
          2 555555759e30    1  48 Selective Wait         mit
      (gdb)
(e.g. the first one properly shows parent and priority under the
correct header).

This is version 2 of the 'task name' patch.
Compared to version 1, the changes are:
   output task names between quotes
   fix the alignment problem in 'info tasks' output on 64 bits systems.

gdb/ChangeLog
2019-08-04  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* NEWS: Announce that Ada task names are now shown at more places,
	and between quotes.
	* gdb/ada-tasks.c (task_to_str): New function.
	(display_current_task_id): Call task_to_str.
	(task_command_1): Likewise.
	(info_task): Output quotes around task name.
	(print_ada_task_info): In non-mi mode, Properly align headers and data
	when task-id length is > 9 (9 is the default for a 32 bits CORE_ADDR).

gdb/doc/ChangeLog
2019-08-04  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.texinfo (Ada Tasks): Tell the task name is printed, update
	examples.

2019-08-04  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.ada/rdv_wait.exp: Update to new task names.
	* gdb.base/task_switch_in_core.exp: Likewise.
	* gdb.base/info_sources_base.c: Likewise.
---
 gdb/NEWS                                      |  3 +
 gdb/ada-tasks.c                               | 72 +++++++++++++++----
 gdb/doc/gdb.texinfo                           | 46 ++++++------
 gdb/testsuite/gdb.ada/rdv_wait.exp            |  2 +-
 gdb/testsuite/gdb.ada/task_switch_in_core.exp | 10 +--
 gdb/testsuite/gdb.ada/tasks.exp               | 16 ++---
 6 files changed, 100 insertions(+), 49 deletions(-)
Eli Zaretskii - Aug. 4, 2019, 4:22 p.m.
> From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Date: Sun,  4 Aug 2019 17:10:51 +0200
> 
> gdb/ChangeLog
> 2019-08-04  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
> 
> 	* NEWS: Announce that Ada task names are now shown at more places,
> 	and between quotes.
> 	* gdb/ada-tasks.c (task_to_str): New function.
> 	(display_current_task_id): Call task_to_str.
> 	(task_command_1): Likewise.
> 	(info_task): Output quotes around task name.
> 	(print_ada_task_info): In non-mi mode, Properly align headers and data
> 	when task-id length is > 9 (9 is the default for a 32 bits CORE_ADDR).
> 
> gdb/doc/ChangeLog
> 2019-08-04  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
> 
> 	* gdb.texinfo (Ada Tasks): Tell the task name is printed, update
> 	examples.
> 
> 2019-08-04  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
> 
> 	* gdb.ada/rdv_wait.exp: Update to new task names.
> 	* gdb.base/task_switch_in_core.exp: Likewise.
> 	* gdb.base/info_sources_base.c: Likewise.

Thanks, the documentation parts look OK.
Tom Tromey - Aug. 13, 2019, 9 p.m.
>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> Also, task names are output between double quotes, similarly to what GDB
Philippe> does for thread names.

Philippe>       (gdb) info task
Philippe>          ID           TID P-ID Pri State                  Name
Philippe>       *   1  555555759030       48 Runnable               "main_task"

I am not sure about using the quoting here.  I had talked my way into
it, but then I saw the implementation...

Philippe> +static std::string
Philippe> +task_to_str (int taskno, const ada_task_info *task_info)
Philippe> +{
Philippe> +    if (task_info->name[0] == '\0')

Looks like this function has too much indentation.

Philippe> +	    const struct ada_task_info *const task_info =
Philippe> +	      &data->task_list[taskno - 1];

The "=" should be on the next line here.

Philippe> +      if (uiout->is_mi_like_p ())
Philippe> +	uiout->field_string ("name",
Philippe> +			     task_info->name[0] != '\0' ? task_info->name
Philippe> +			     : _("<no name>"));
Philippe> +      else
Philippe> +	{
Philippe> +	  uiout->field_fmt ("name",
Philippe> +			    "\"%s\"",
Philippe> +			    task_info->name[0] != '\0' ? task_info->name
Philippe> +			    : _("<no name>"));
Philippe> +	}

I'm not a big fan of using is_mi_like_p in general, and here it seems
especially ugly.

thanks,
Tom
Philippe Waroquiers - Aug. 14, 2019, 4:55 a.m.
On Tue, 2019-08-13 at 15:00 -0600, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
> 
> Philippe> Also, task names are output between double quotes, similarly to what GDB
> Philippe> does for thread names.
> 
> Philippe>       (gdb) info task
> Philippe>          ID           TID P-ID Pri State                  Name
> Philippe>       *   1  555555759030       48 Runnable               "main_task"
> 
> I am not sure about using the quoting here.  I had talked my way into
> it, but then I saw the implementation...
> 
> Philippe> +static std::string
> Philippe> +task_to_str (int taskno, const ada_task_info *task_info)
> Philippe> +{
> Philippe> +    if (task_info->name[0] == '\0')
> 
> Looks like this function has too much indentation.
> 
> Philippe> +	    const struct ada_task_info *const task_info =
> Philippe> +	      &data->task_list[taskno - 1];
> 
> The "=" should be on the next line here.
> 
> Philippe> +      if (uiout->is_mi_like_p ())
> Philippe> +	uiout->field_string ("name",
> Philippe> +			     task_info->name[0] != '\0' ? task_info->name
> Philippe> +			     : _("<no name>"));
> Philippe> +      else
> Philippe> +	{
> Philippe> +	  uiout->field_fmt ("name",
> Philippe> +			    "\"%s\"",
> Philippe> +			    task_info->name[0] != '\0' ? task_info->name
> Philippe> +			    : _("<no name>"));
> Philippe> +	}
> 
> I'm not a big fan of using is_mi_like_p in general, and here it seems
> especially ugly.

The above code can probably be made less ugly, e.g. by using one single
call to field_fmt and ensure quotes are not output when is_mi_like_p.

But if we want to have quotes around task names (like thread names), and
not break the mi interface, I do not see how to not use is_mi_like_p
(which is used at a lot of places for such things).

So, I can either rollback the addition of quotes, or (slightly) cleanup
the code above.
What do you prefer ?
(or any other suggestion about how to do quotes cleanly?).

Thanks

Philippe
Tom Tromey - Aug. 14, 2019, 5:31 p.m.
>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> So, I can either rollback the addition of quotes, or (slightly) cleanup
Philippe> the code above.
Philippe> What do you prefer ?
Philippe> (or any other suggestion about how to do quotes cleanly?).

What do you think of using quotes in most places, but not in "info tasks"?

Tom
Philippe Waroquiers - Aug. 14, 2019, 10:08 p.m.
On Wed, 2019-08-14 at 11:31 -0600, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
> 
> Philippe> So, I can either rollback the addition of quotes, or (slightly) cleanup
> Philippe> the code above.
> Philippe> What do you prefer ?
> Philippe> (or any other suggestion about how to do quotes cleanly?).
> 
> What do you think of using quotes in most places, but not in "info tasks"?
IMO, using the same convention everywhere for a task name (i.e. using quotes)
and the same convention as thread name is a nice thing to have.
That e.g. gives the below, where thread and task names have now the same
representation.

(gdb) info threads
  Id   Target Id                                       Frame 
  1    Thread 0x7ffff79eb740 (LWP 6164) "foo"          futex_wait_cancelable (
    private=0, expected=0, futex_word=0x55555555e3f4)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  2    Thread 0x7ffff79ea700 (LWP 6203) "task_list(1)" foo.break_me ()
    at /bd/home/philippe/gdb/git/pipe/gdb/testsuite/gdb.ada/tasks/foo.adb:27
* 3    Thread 0x7ffff77e5700 (LWP 6205) "task_list(2)" futex_wait_cancelable (
    private=0, expected=0, futex_word=0x555555562964)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  4    Thread 0x7ffff75e0700 (LWP 6207) "task_list(3)" futex_wait_cancelable (
    private=0, expected=0, futex_word=0x5555555660e4)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
(gdb) info task
   ID           TID P-ID Pri State                  Name
    1  55555555e280       48 Waiting on RV with 2   "main_task"
    2  55555555f070    1  48 Accepting RV with 1    "task_list(1)"
*   3  5555555627f0    1  48 Accept or Select Term  "task_list(2)"
    4  555555565f70    1  48 Accept or Select Term  "task_list(3)"
(gdb)

This is IMO worth having the "if" on is_mi_like_p.
The code can be made somewhat cleaner like the below:

+      /* Finally, print the task name, without quotes for mi like.  */
+      {
+       const char *opt_quote = (uiout->is_mi_like_p () ? "" : "\"");
+
+       uiout->field_fmt ("name",
+                         "%s%s%s",
+                         opt_quote,
+                         task_info->name[0] != '\0' ? task_info->name
+                         : _("<no name>"),
+                         opt_quote);
+      }


I have fixed the other comments.

Thanks for the review,

Philippe

Patch

diff --git a/gdb/NEWS b/gdb/NEWS
index da641cb598..174c8f66de 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -25,6 +25,9 @@ 
   provide the exitcode or exit status of the shell commands launched by
   GDB commands such as "shell", "pipe" and "make".
 
+* GDB now 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 a623888704..c13558500e 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -240,6 +240,18 @@  struct ada_tasks_inferior_data
 static const struct inferior_key<ada_tasks_inferior_data>
   ada_tasks_inferior_data_handle;
 
+/* Return a string with TASKNO followed by the task name if TASK_INFO
+   contains a name.  */
+
+static std::string
+task_to_str (int taskno, const ada_task_info *task_info)
+{
+    if (task_info->name[0] == '\0')
+      return string_printf ("%d", taskno);
+    else
+      return string_printf ("%d \"%s\"", taskno, task_info->name);
+}
+
 /* Return the ada-tasks module's data for the given program space (PSPACE).
    If none is found, add a zero'ed one now.
 
@@ -1047,7 +1059,26 @@  print_ada_task_info (struct ui_out *uiout,
   ui_out_emit_table table_emitter (uiout, nb_columns, nb_tasks, "tasks");
   uiout->table_header (1, ui_left, "current", "");
   uiout->table_header (3, ui_right, "id", "ID");
-  uiout->table_header (9, ui_right, "task-id", "TID");
+  {
+    size_t tid_width = 9;
+    /* Grown below in case the largest entry is bigger.  */
+
+    if (!uiout->is_mi_like_p ())
+      {
+	for (taskno = 1; taskno <= data->task_list.size (); taskno++)
+	  {
+	    const struct ada_task_info *const task_info =
+	      &data->task_list[taskno - 1];
+
+	    gdb_assert (task_info != NULL);
+
+	    tid_width = std::max (tid_width,
+				  1 + strlen (phex_nz (task_info->task_id,
+						       sizeof (CORE_ADDR))));
+	  }
+      }
+    uiout->table_header (tid_width, ui_right, "task-id", "TID");
+  }
   /* The following column is provided in GDB/MI mode only because
      it is only really useful in that mode, and also because it
      allows us to keep the CLI output shorter and more compact.  */
@@ -1130,9 +1161,17 @@  print_ada_task_info (struct ui_out *uiout,
 	uiout->field_string ("state", task_states[task_info->state]);
 
       /* Finally, print the task name.  */
-      uiout->field_string ("name",
-			   task_info->name[0] != '\0' ? task_info->name
-			   : _("<no name>"));
+      if (uiout->is_mi_like_p ())
+	uiout->field_string ("name",
+			     task_info->name[0] != '\0' ? task_info->name
+			     : _("<no name>"));
+      else
+	{
+	  uiout->field_fmt ("name",
+			    "\"%s\"",
+			    task_info->name[0] != '\0' ? task_info->name
+			    : _("<no name>"));
+	}
 
       uiout->text ("\n");
     }
@@ -1166,7 +1205,7 @@  info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf)
 
   /* Print the name of the task.  */
   if (task_info->name[0] != '\0')
-    printf_filtered (_("Name: %s\n"), task_info->name);
+    printf_filtered (_("Name: \"%s\"\n"), task_info->name);
   else
     printf_filtered (_("<no name>\n"));
 
@@ -1187,7 +1226,7 @@  info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf)
 
       printf_filtered (_("Parent: %d"), parent_taskno);
       if (parent->name[0] != '\0')
-        printf_filtered (" (%s)", parent->name);
+        printf_filtered (" (\"%s\")", parent->name);
       printf_filtered ("\n");
     }
   else
@@ -1220,7 +1259,7 @@  info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf)
         ada_task_info *target_task_info = &data->task_list[target_taskno - 1];
 
         if (target_task_info->name[0] != '\0')
-          printf_filtered (" (%s)", target_task_info->name);
+          printf_filtered (" (\"%s\")", target_task_info->name);
       }
 
     printf_filtered ("\n");
@@ -1255,7 +1294,14 @@  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];
+
+      printf_filtered (_("[Current task is %s]\n"),
+		       task_to_str (current_task, task_info).c_str ());
+    }
 }
 
 /* Parse and evaluate TIDSTR into a task id, and try to switch to
@@ -1274,7 +1320,8 @@  task_command_1 (const char *taskno_str, int from_tty, struct inferior *inf)
   task_info = &data->task_list[taskno - 1];
 
   if (!ada_task_is_alive (task_info))
-    error (_("Cannot switch to task %d: Task is no longer running"), taskno);
+    error (_("Cannot switch to task %s: Task is no longer running"),
+	   task_to_str (taskno, task_info).c_str ());
    
   /* On some platforms, the thread list is not updated until the user
      performs a thread-related operation (by using the "info threads"
@@ -1295,13 +1342,14 @@  task_command_1 (const char *taskno_str, int from_tty, struct inferior *inf)
      it's nicer for the user to just refuse to perform the task switch.  */
   thread_info *tp = find_thread_ptid (task_info->ptid);
   if (tp == NULL)
-    error (_("Unable to compute thread ID for task %d.\n"
+    error (_("Unable to compute thread ID for task %s.\n"
              "Cannot switch to this task."),
-           taskno);
+           task_to_str (taskno, task_info).c_str ());
 
   switch_to_thread (tp);
   ada_find_printable_frame (get_selected_frame (NULL));
-  printf_filtered (_("[Switching to task %d]\n"), taskno);
+  printf_filtered (_("[Switching to task %s]\n"),
+		   task_to_str (taskno, task_info).c_str ());
   print_stack_frame (get_selected_frame (NULL),
                      frame_relative_level (get_selected_frame (NULL)),
 		     SRC_AND_LOC, 1);
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 89b1eda2c1..63ecc902b3 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -17661,10 +17661,10 @@  This command shows a list of current Ada tasks, as in the following example:
 @end iftex
 (@value{GDBP}) info tasks
   ID       TID P-ID Pri State                 Name
-   1   8088000   0   15 Child Activation Wait main_task
-   2   80a4000   1   15 Accept Statement      b
-   3   809a800   1   15 Child Activation Wait a
-*  4   80ae800   3   15 Runnable              c
+   1   8088000   0   15 Child Activation Wait "main_task"
+   2   80a4000   1   15 Accept Statement      "b"
+   3   809a800   1   15 Child Activation Wait "a"
+*  4   80ae800   3   15 Runnable              "c"
 
 @end smallexample
 
@@ -17747,14 +17747,14 @@  the following example:
 @end iftex
 (@value{GDBP}) info tasks
   ID       TID P-ID Pri State                  Name
-   1   8077880    0  15 Child Activation Wait  main_task
-*  2   807c468    1  15 Runnable               task_1
+   1   8077880    0  15 Child Activation Wait  "main_task"
+*  2   807c468    1  15 Runnable               "task_1"
 (@value{GDBP}) info task 2
 Ada Task: 0x807c468
-Name: task_1
+Name: "task_1"
 Thread: 0
 LWP: 0x1fac
-Parent: 1 (main_task)
+Parent: 1 ("main_task")
 Base Priority: 15
 State: Runnable
 @end smallexample
@@ -17762,7 +17762,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
@@ -17770,10 +17770,10 @@  This command prints the ID of the current task.
 @end iftex
 (@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
+   1   8077870    0  15 Child Activation Wait  "main_task"
+*  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}
@@ -17788,10 +17788,10 @@  from the current task to the given task.
 @end iftex
 (@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
+   1   8077870    0  15 Child Activation Wait  "main_task"
+*  2   807c458    1  15 Runnable               "some_task"
 (@value{GDBP}) task 1
-[Switching to task 1]
+[Switching to task 1 "main_task"]
 #0  0x8067726 in pthread_cond_wait ()
 (@value{GDBP}) bt
 #0  0x8067726 in pthread_cond_wait ()
@@ -17833,10 +17833,10 @@  For example,
 @end iftex
 (@value{GDBP}) info tasks
   ID       TID P-ID Pri State                 Name
-   1 140022020   0   15 Child Activation Wait main_task
-   2 140045060   1   15 Accept/Select Wait    t2
-   3 140044840   1   15 Runnable              t1
-*  4 140056040   1   15 Runnable              t3
+   1 140022020   0   15 Child Activation Wait "main_task"
+   2 140045060   1   15 Accept/Select Wait    "t2"
+   3 140044840   1   15 Runnable              "t1"
+*  4 140056040   1   15 Runnable              "t3"
 (@value{GDBP}) b 15 task 2
 Breakpoint 5 at 0x120044cb0: file test_task_debug.adb, line 15.
 (@value{GDBP}) cont
@@ -17848,10 +17848,10 @@  Breakpoint 5, test_task_debug () at test_task_debug.adb:15
 15               flush;
 (@value{GDBP}) info tasks
   ID       TID P-ID Pri State                 Name
-   1 140022020   0   15 Child Activation Wait main_task
-*  2 140045060   1   15 Runnable              t2
-   3 140044840   1   15 Runnable              t1
-   4 140056040   1   15 Delay Sleep           t3
+   1 140022020   0   15 Child Activation Wait "main_task"
+*  2 140045060   1   15 Runnable              "t2"
+   3 140044840   1   15 Runnable              "t1"
+   4 140056040   1   15 Delay Sleep           "t3"
 @end smallexample
 @end table
 
diff --git a/gdb/testsuite/gdb.ada/rdv_wait.exp b/gdb/testsuite/gdb.ada/rdv_wait.exp
index c0c4e29f5f..fe6aec3bcd 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..d8e4f3c19d 100644
--- a/gdb/testsuite/gdb.ada/task_switch_in_core.exp
+++ b/gdb/testsuite/gdb.ada/task_switch_in_core.exp
@@ -59,8 +59,8 @@  gdb_test "task 1" \
 
 gdb_test "info tasks" \
          [multi_line "\\s+ID\\s+TID\\s+P-ID\\s+Pri\\s+State\\s+Name" \
-                     "\\*\\s+1\\s+.*main_task" \
-                     "\\s+2.*my_t"] \
+                     "\\*\\s+1\\s+.*\"main_task\"" \
+                     "\\s+2.*\"my_t\""] \
          "info tasks after switching to task 1"
 
 # Switch to task 2. Unlike in the case where we tested the switch to
@@ -71,10 +71,10 @@  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" \
-                     "\\s+1\\s+.*main_task" \
-                     "\\*\\s+2.*my_t"] \
+                     "\\s+1\\s+.*\"main_task\"" \
+                     "\\*\\s+2.*\"my_t\""] \
          "info tasks after switching to task 2"
diff --git a/gdb/testsuite/gdb.ada/tasks.exp b/gdb/testsuite/gdb.ada/tasks.exp
index 46a53fe76c..349001b232 100644
--- a/gdb/testsuite/gdb.ada/tasks.exp
+++ b/gdb/testsuite/gdb.ada/tasks.exp
@@ -30,10 +30,10 @@  runto "foo.adb:$bp_location"
 # that the active task is the environment task.
 gdb_test "info tasks" \
          [join {" +ID +TID P-ID Pri State +Name" \
-                "\\* +1 .* main_task" \
-                " +2 .* task_list\\(1\\)" \
-                " +3 .* task_list\\(2\\)" \
-                " +4 .* task_list\\(3\\)"} \
+                "\\* +1 .* \"main_task\"" \
+                " +2 .* \"task_list\\(1\\)\"" \
+                " +3 .* \"task_list\\(2\\)\"" \
+                " +4 .* \"task_list\\(3\\)\""} \
                "\r\n"] \
          "info tasks before inserting breakpoint"
 
@@ -72,10 +72,10 @@  gdb_test "continue" \
 # which is the active task.
 gdb_test "info tasks" \
          [join {" +ID +TID P-ID Pri State +Name" \
-                " +1 .* main_task" \
-                " +2 .* task_list\\(1\\)" \
-                "\\* +3 .* task_list\\(2\\)" \
-                " +4 .* task_list\\(3\\)"} \
+                " +1 .* \"main_task\"" \
+                " +2 .* \"task_list\\(1\\)\"" \
+                "\\* +3 .* \"task_list\\(2\\)\"" \
+                " +4 .* \"task_list\\(3\\)\""} \
                "\r\n"] \
          "info tasks after hitting breakpoint"