From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87153 invoked by alias); 14 Aug 2019 04:56:01 -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 87144 invoked by uid 89); 14 Aug 2019 04:56:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=H*F:D*be, UD:be X-HELO: mailsec103.isp.belgacom.be Received: from mailsec103.isp.belgacom.be (HELO mailsec103.isp.belgacom.be) (195.238.20.99) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Aug 2019 04:55:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1565758558; x=1597294558; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q+ALbW4B8LK7A/2RAkFHTdq1zfXLQ4mQw2DKIDpLPFk=; b=vom3weOMG1jar+4pKRwiZ1w0Cvhp7E996DqTKVol+bQGUXW2jkOuLg1K OGhpAspeetmVRFI3zjOxCMiA2hCr9Q==; 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; 14 Aug 2019 06:55:55 +0200 Message-ID: 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 04:56:00 -0000 In-Reply-To: <8736i4wzk8.fsf@tromey.com> References: <20190804151051.3356-1-philippe.waroquiers@skynet.be> <8736i4wzk8.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/msg00282.txt.bz2 On Tue, 2019-08-13 at 15:00 -0600, Tom Tromey wrote: > > > > > > "Philippe" == Philippe Waroquiers 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> + : _("")); > Philippe> + else > Philippe> + { > Philippe> + uiout->field_fmt ("name", > Philippe> + "\"%s\"", > Philippe> + task_info->name[0] != '\0' ? task_info->name > Philippe> + : _("")); > 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