From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92608 invoked by alias); 6 Oct 2018 16:34:39 -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 92350 invoked by uid 89); 6 Oct 2018 16:34:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=cli-out, cliout, Hx-languages-length:1086, ui-out X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 06 Oct 2018 16:34:37 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 334D81E4C2; Sat, 6 Oct 2018 12:34:36 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1538843676; bh=b86GGyvzqnUOnvAxU5ZUJR2M1VlyBeg3cHke+wc+1FQ=; h=Subject:To:References:From:Date:In-Reply-To:From; b=O05i+434pv+OyAD0URSxJwxhTT+xmZGRbFQ1AHsnbAv9haLfDk8RPuvSF/tSujX43 Jfaeg8cBQ87X4a5E9/Hm6wMAGW4N/JvC17Gcnk19OPpcIumGD43wUwOmt5vCsc4ZNB T7jcAEDbUeOEJh8hGe0uO0XKbdyRAbRnN16w7XEA= Subject: Re: [RFC 4/8] Add variable name styling To: Tom Tromey , gdb-patches@sourceware.org References: <20180906211303.11029-1-tom@tromey.com> <20180906211303.11029-5-tom@tromey.com> From: Simon Marchi Message-ID: Date: Sat, 06 Oct 2018 16:34:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20180906211303.11029-5-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-10/txt/msg00147.txt.bz2 On 2018-09-06 5:12 p.m., Tom Tromey wrote: > This adds style support for variable names. For the time being, this > is only done in backtraces, not in ptype or print; those places do not > use ui-out and so would need ad hoc changes. > > Because "name" is a relatively common MI field name, simple name > recognition does not work for variable names. So, this patch changes > cli-out to track the enclosing list name, and only colorize "name" > when appearing somewhere within a list named "args". This patch misses an include for it to build on its own. This is a case where I think the suggestion I made in my previous message would help. It would be much clearer and less magic if the caller just explicitly communicated the intent of printing a variable, rather than cli-out trying to guess. So in print_frame_args, we could have -uiout->field_stream ("name", stb); +uiout->field_stream ("name", stb, print_style::VARIABLE); or maybe even pass the style object directly uiout->field_stream ("name", stb, variable_name_style); Simon