From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id B8y/AkRuCWAoBgAAWB0awg (envelope-from ) for ; Thu, 21 Jan 2021 07:06:28 -0500 Received: by simark.ca (Postfix, from userid 112) id F0C2D1EF80; Thu, 21 Jan 2021 07:06:27 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8D1C31E939 for ; Thu, 21 Jan 2021 07:06:26 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 04E0F386185A; Thu, 21 Jan 2021 12:06:26 +0000 (GMT) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 53C95386184A for ; Thu, 21 Jan 2021 12:06:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 53C95386184A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wm1-x32d.google.com with SMTP id m2so1239955wmm.1 for ; Thu, 21 Jan 2021 04:06:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=b6aFUwW2jygEywi4ssX7Aw9/pL4qUd6ijbfSnmCgUxw=; b=HIk61+JAF9r8ZZ5mq7ElctgqnOrYb00czXAiegnnhhQ0XIuUIrEeZLsrsLj23crmXZ kT6Iy6LV0xFMlWSVbjW4Mm9R1IR+4W17W9EBIUFD70TixCYNKuRL/EvAzvUnmlWUxgZB f3VVmyfHmuOkWIB3MejBy89hij323VKiotYeE/VYTHixeYO+IUmdxgRzuY5bGrIlf/dz 8tmo8D2KyCugjaPfmO8xqHvM1Pg2htDKlsBIQ/0cobvIGLtM8soT9paE2gVkqOBYrwDt TgeOGpBjlW4QHLz814aFR0+uJ0NqHE35lP0J+Hs7rgnZL+ZT3C60raZczzCAQ7yqLZkH wpkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=b6aFUwW2jygEywi4ssX7Aw9/pL4qUd6ijbfSnmCgUxw=; b=OY1JpFMSqvnFWn++RDZ6gR5K9vYRuBGA8eEltf0rdYVs4T0owxvS7rszzm52Gdfy7o ieLJD/sT0sLQM1ON+HRb9/Z1hjeA/OhE0jl1VBBEBFkQIahv/5REtO2lpTYa5bky5Lo5 mC0/FeqWwSkxWAS0Hfiuq2yZFBfKys2Cfvl1CDB33ko24Er/S3Y75aR+pGPDNxbFDcur oFApNoWR+TrRhMQgPO4piYqka6BJ1N+WLi4jO4ZcabgBOxN2XKmrb2l2YNZ355qNk5JF cFRDfkSj3i2cLmdqHfAOb6PbdNaaR9Uli38N9YW00jm41Ib2GRQeAsMbvecBkGl6VZL4 8XHg== X-Gm-Message-State: AOAM530eDJY1d3Ysqet2WXpp/FdY2/DHOQuA2nziejOg8OfO3+1HaYPs fkCOQeta9iFi78KYAAhhlK/4IS2dk0l3iQ== X-Google-Smtp-Source: ABdhPJwg88sJcPpqS11fyjoQQBkKqNVCDdB2bucxiSO6o7D163TBnV/rlmaESSDwMVi+pIPTCQITEQ== X-Received: by 2002:a1c:4303:: with SMTP id q3mr8743790wma.3.1611230780481; Thu, 21 Jan 2021 04:06:20 -0800 (PST) Received: from localhost (host109-154-20-185.range109-154.btcentralplus.com. [109.154.20.185]) by smtp.gmail.com with ESMTPSA id l1sm967614wrp.40.2021.01.21.04.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 04:06:19 -0800 (PST) Date: Thu, 21 Jan 2021 12:06:18 +0000 From: Andrew Burgess To: Tom Tromey Subject: Re: [PATCH 1/2] gdb: don't print escape characters when a style is disabled Message-ID: <20210121120618.GX265215@embecosm.com> References: <87k0s75rn0.fsf@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k0s75rn0.fsf@tromey.com> X-Operating-System: Linux/5.8.13-100.fc31.x86_64 (x86_64) X-Uptime: 12:02:02 up 43 days, 16:46, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" * Tom Tromey [2021-01-20 12:34:43 -0700]: > >>>>> "Andrew" == Andrew Burgess writes: > > Andrew> +# A replacement for the 'style' function found in gdb-utils.exp, > Andrew> +# filter out requests for the disabled style. > Andrew> +proc limited_style { str style } { > > Rather than rename the global 'style', I think it would be fine to just > have a wrapper proc that is used locally. That seems a lot less tricky. > Same with clean_restart. > > Andrew> /* Output pmatch with the highlight style. */ > Andrew> - set_output_style (stream, highlight_style.style ()); > Andrew> + if (!highlight_style.style ().is_default ()) > Andrew> + set_output_style (stream, highlight_style.style ()); > > set_output_style ends up setting applied_style. > So avoiding this call seems iffy to me. Tom, Thanks for the feedback. It's not clear to me if your feedback is about this one particular use of the 'if (!STYLE.is_default ()) { ... }' pattern, or if you are suggesting all uses of this pattern are suspect. It's just that you added the original uses of this pattern... So I guess my question would be, if its this one particular case then I don't understand why this cases is different to all the others, or... ... if it's all uses of this pattern then I guess my questions is, does this mean you think the original uses were a mistake? Or has something else changed ? > Maybe another approach would be to change emit_style_escape so that it > does nothing if the currently-applied style is equal to the passed-in > style? I'll give this a try and see if I can get this working. Thanks, Andrew