[RFA] (Ada) do not print Ada task names in quotes in "info tasks" output

Message ID 1568651068-135467-1-git-send-email-brobecker@adacore.com
State New, archived
Headers

Commit Message

Joel Brobecker Sept. 16, 2019, 4:24 p.m. UTC
  Hello,

A recent change enhanced a couple of notifications about Ada tasks to
include the task's name in addition to the task's number. That change
also modified the output of the "info tasks" when printing the detailed
information of one given task. I believe this change was unintentionally
left over from the initial version after it was decided that quoting
the task's name should not be done. This patch therefore undoes this
part of the patch.

gdb/ChangeLog:

        * ada-tasks.c (info_task): Remove quoting of the task's name.

Tested on x86_64-linux, with both the official testsuite as well as
AdaCore's testsuite.

OK to push to master?

Thank you!
  

Comments

Philippe Waroquiers Sept. 16, 2019, 6:09 p.m. UTC | #1
Note that I understood the idea was to use quotes, except
in 'info task' table output.

But FWIW, the below is ok for me.

Thanks
Philippe


On Mon, 2019-09-16 at 12:24 -0400, Joel Brobecker wrote:
> Hello,
> 
> A recent change enhanced a couple of notifications about Ada tasks to
> include the task's name in addition to the task's number. That change
> also modified the output of the "info tasks" when printing the detailed
> information of one given task. I believe this change was unintentionally
> left over from the initial version after it was decided that quoting
> the task's name should not be done. This patch therefore undoes this
> part of the patch.
> 
> gdb/ChangeLog:
> 
>         * ada-tasks.c (info_task): Remove quoting of the task's name.
> 
> Tested on x86_64-linux, with both the official testsuite as well as
> AdaCore's testsuite.
> 
> OK to push to master?
> 
> Thank you!
> -- 
> Joel
> 
> ---
>  gdb/ada-tasks.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
> index 34da786..24ceab1 100644
> --- a/gdb/ada-tasks.c
> +++ b/gdb/ada-tasks.c
> @@ -1199,7 +1199,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"));
>  
> @@ -1220,7 +1220,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
> @@ -1253,7 +1253,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");
  
Tom Tromey Sept. 17, 2019, 2:55 p.m. UTC | #2
>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> Note that I understood the idea was to use quotes, except
Philippe> in 'info task' table output.

I thought so too, but I missed the "Name:" case in "info_task" -- that
one seems like it should be quote-less to me.

Philippe> But FWIW, the below is ok for me.

Me too.

Tom
  
Joel Brobecker Sept. 17, 2019, 6:29 p.m. UTC | #3
> >>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
> 
> Philippe> Note that I understood the idea was to use quotes, except
> Philippe> in 'info task' table output.
> 
> I thought so too, but I missed the "Name:" case in "info_task" -- that
> one seems like it should be quote-less to me.
> 
> Philippe> But FWIW, the below is ok for me.
> 
> Me too.

Thank you both! I just pushed the patch to master.
  

Patch

diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 34da786..24ceab1 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1199,7 +1199,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"));
 
@@ -1220,7 +1220,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
@@ -1253,7 +1253,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");