From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by sourceware.org (Postfix) with ESMTPS id ACCFC3858D38 for ; Thu, 23 Jul 2020 20:02:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org ACCFC3858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=alves.ped@gmail.com Received: by mail-wr1-f67.google.com with SMTP id r4so3345864wrx.9; Thu, 23 Jul 2020 13:02:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PmzutdLS2nH2yeiYVF5IMEr+4UBguPC6BFMnzp5+YRE=; b=FpcePWbRiECIWMkZuYHEsUif8EGL0ngcbe14NsTSVl/iPUb77nYusIyq6VxvSZJQJp lVcoM016BlXozKYXQUxWywnaVo+GlP/mg8x7lKnUn/vVt2SVKjNyR3bNVg9CnZ605rmX uE5RimS5RKEuCqX8dBSNa4VIYRdIj9DNVOZm+MVTeCVKoaMPKk8vZRpvqnMCPOzRulef 5BDytkFWKfpyAwZGsdhgD7EdXXMMTacFwlG/bta04NxvRkDFiWUm58LbLZ9S/LRxwCJw XvR7WIPhnYdISsMlRvY1hWIdBSA8EUSbPJ3GgacAYw//fVELP7PFFbJ9m6fH8AY1GgBo ocdg== X-Gm-Message-State: AOAM530UWDbBX9m978xzfMabMrXA1eV7pNQ3j1tQ9HHUz6Ce2EL8Z3I+ gFWO7iUSbInxJMguXjO7lkukAMb8typOAw== X-Google-Smtp-Source: ABdhPJxwXjbWYnG55wtRZ4LNmjabk5QSrqGZT7yzNOVf8eLx1VJM7VN52jtaLjg1NdICOnu7O/+Udg== X-Received: by 2002:adf:ea0c:: with SMTP id q12mr5223973wrm.382.1595534520694; Thu, 23 Jul 2020 13:02:00 -0700 (PDT) Received: from ?IPv6:2001:8a0:f91a:c400:56ee:75ff:fe8d:232b? ([2001:8a0:f91a:c400:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id m128sm4573471wmf.37.2020.07.23.13.01.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jul 2020 13:01:59 -0700 (PDT) Subject: Re: [PATCH 1/4] gdb: rename regcache::current_regcache to regcache::regcaches To: Simon Marchi , gdb-patches@sourceware.org References: <20200720204101.2849535-1-simon.marchi@efficios.com> <20200720204101.2849535-2-simon.marchi@efficios.com> Cc: Morichetti@sourceware.org, Laurent From: Pedro Alves Message-ID: <0cf1560d-0e39-eb5b-40ea-fa1a26117a9d@palves.net> Date: Thu, 23 Jul 2020 21:01:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20200720204101.2849535-2-simon.marchi@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Thu, 23 Jul 2020 20:02:03 -0000 Hi! On 7/20/20 9:40 PM, Simon Marchi via Gdb-patches wrote: > The name `current_regcache` for the list of currently-existing regcaches > sounds wrong. The name is singular, but it holds multiple regcaches, so > it could at least be `current_regcaches`. > > But in other places in GDB, "current" usually means "the object we are > working with right now". For example, we swap the "current thread" when > we want to operate on a given thread. This is not the case here, this > variable just holds all regcaches that exist at any given time, not "the > regcache we are working with right now". It used to hold a single regcache, and then it was made a list: https://sourceware.org/pipermail/gdb-patches/2009-June/065986.html ... but the name wasn't changed. > > So, I think calling it `regcaches` is better. I also considered > `regcache_list`, but a subsequent patch will make it a map and not a > list, so it would sound wrong again. `regcaches` sounds right for any > collection of regcache, whatever the type. > > Rename a few other things that were related to this `current_regcache` > field. Note that there is a `get_current_regcache` function, which > returns the regcache of the current thread. That one is fine, because > it returns the regcache for the current thread. > > gdb/ChangeLog: > > * regcache.h (class regcache) : Rename to... > : ... this. Move doc here. > * regcache.c (regcache::current_regcache) Rename to... > (regcache::regcaches): ... this. Move doc to header. > (get_thread_arch_aspace_regcache): Update. > (regcache::regcache_thread_ptid_changed): Update. > (registers_changed_ptid): Update. > (class regcache_access) : Rename to... > : ... this. > (current_regcache_test): Rename to... > (regcaches_test): ... this. > (_initialize_regcache): Update. OK. Thanks, Pedro Alves