This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFAv2] Output the Ada task name in more messages, output task names between "".
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