From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id /hVzBMjGAWF0KQAAWB0awg (envelope-from ) for ; Wed, 28 Jul 2021 17:06:16 -0400 Received: by simark.ca (Postfix, from userid 112) id 032F41EDFB; Wed, 28 Jul 2021 17:06:15 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [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 26C241E813 for ; Wed, 28 Jul 2021 17:06:15 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6A36639A5405 for ; Wed, 28 Jul 2021 21:06:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A36639A5405 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1627506374; bh=u9RC5P1V1llVECyJMJx1hkCGqYE0OW6ANdQNZhdVV40=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=P5w0rJrG3ToB6kH4h1e+dIxtpEm2/H3gdO9Ct0MLloctAxf7uqUw4h8wzVkkNijKP bEqLFIPtOxudmmV3iR2P4PFYlc5n1xCD8Tdg9yXSQq77h1NI28EIAoZeEeksjYeVs0 2/E4VmfmUbKrHgoFVurFpkb+s8WlIBK1DPsL7dMo= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id A3A5C39A3C0B for ; Wed, 28 Jul 2021 21:03:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A3A5C39A3C0B Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 16SL3hQd029530 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jul 2021 17:03:47 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 16SL3hQd029530 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 0424B1E813; Wed, 28 Jul 2021 17:03:42 -0400 (EDT) Subject: Re: [PATCH 16/16] gdb: make string-like set show commands use std::string variable To: Tom Tromey , Simon Marchi via Gdb-patches References: <20210714045520.1623120-1-simon.marchi@polymtl.ca> <20210714045520.1623120-17-simon.marchi@polymtl.ca> <87o8amchfu.fsf@tromey.com> Message-ID: <0edeb3c4-21fe-b368-6c2e-fbb6028eb859@polymtl.ca> Date: Wed, 28 Jul 2021 17:03:42 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <87o8amchfu.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 28 Jul 2021 21:03:43 +0000 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2021-07-28 4:27 p.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> String-like settings (var_string, var_filename, var_optional_filename, > Simon> var_string_noescape) currently take a pointer to a `char *` storage > Simon> variable (typically global) that holds the setting's value. I'd like to > Simon> "mordernize" this by changing them to use an std::string for storage. > > It seems like a decent idea to me. I didn't go through the patch. I > imagine it's mostly fairly mechanical transforms. Yes, although there could be more subtle cases where empty string vs nullptr did matter. > Simon> The add_path function in source.c is really complex and twisted, I'd > Simon> rather not try to change it to work on an std::string right now. > Simon> Instead, I added an overload that copies the std:string to a `char *` > Simon> and back. This means more copying, but this is not used in a hot path > Simon> at all, so I think it is acceptable. > > That seems fine. It might be nice if we had a way to track these little > cleanup items. Maybe a tag in bugzilla. I'll try to think adding one when this patch (a subsequent version of it) gets merged. > I suppose the main danger of this patch is lingering old-style variables > in code you couldn't build, say some of the less-supported native > targets. But, we usually handle those on a best-effort basis anyway. > And, maybe they don't use this feature. I did my best to grep and check for those native files I know aren't compiled, but as you say it's best effort. Like with other code-base-wide changes, I think that if I forgot any spots, they will be very easy to fix. Simon