From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33702 invoked by alias); 14 Aug 2019 22:08:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 33681 invoked by uid 89); 14 Aug 2019 22:08:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=UD:gdb.ada, gdb.ada, gdbada, UD:ada X-HELO: mailsec104.isp.belgacom.be Received: from mailsec104.isp.belgacom.be (HELO mailsec104.isp.belgacom.be) (195.238.20.100) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Aug 2019 22:08:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1565820536; x=1597356536; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=naPKN3eOXRydmZa5bxQo8shRT5mDOY5mI1JZaUezZSY=; b=PcTj4/ELyuscv/RjSFnhIYuRsl8GM7A5/76a13+hUYJrYotswceH0cYb ls7Xbc0hqtFV47D0wYfKgcjpB5rDsg==; Received: from 96.218-128-109.adsl-dyn.isp.belgacom.be (HELO md) ([109.128.218.96]) by relay.skynet.be with ESMTP/TLS/AES256-GCM-SHA384; 15 Aug 2019 00:08:54 +0200 Message-ID: <6185768b61d65d73514844b41aa9ba4861051c9f.camel@skynet.be> Subject: Re: [RFAv2] Output the Ada task name in more messages, output task names between "". From: Philippe Waroquiers To: Tom Tromey Cc: gdb-patches@sourceware.org Date: Wed, 14 Aug 2019 22:08:00 -0000 In-Reply-To: <87imqzveli.fsf@tromey.com> References: <20190804151051.3356-1-philippe.waroquiers@skynet.be> <8736i4wzk8.fsf@tromey.com> <87imqzveli.fsf@tromey.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00311.txt.bz2 On Wed, 2019-08-14 at 11:31 -0600, Tom Tromey wrote: > > > > > > "Philippe" == Philippe Waroquiers 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 + : _(""), + opt_quote); + } I have fixed the other comments. Thanks for the review, Philippe