From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33679 invoked by alias); 13 Feb 2020 20:31:53 -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 33351 invoked by uid 89); 13 Feb 2020 20:31:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=H*MI:sk:10770a5, H*f:sk:10770a5, initialize_low, H*i:sk:10770a5 X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Feb 2020 20:31:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581625910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3UVS0dCOIQ5ALcIGnD9fGNJ7IoGg1hrcoE7ltSvk2uE=; b=ehNrZxAZItSOXCVrDZq+SduMLVm+cjUq7u2Ei3WbqcD7508Xt+Jrrzpuczpzam091zbBxa pcMkiD77GkhBFvL5PUCmYxhcjhVsIFRmmtodvT111YYDP+DG0VmOKbdz20+QQl0kc5lbiH uoK5e+B2qEvvDFIhksT0EzOrEl841wc= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-61-4CK6_0GuN12f52Tu_908uw-1; Thu, 13 Feb 2020 15:31:49 -0500 Received: by mail-wm1-f71.google.com with SMTP id t17so2462213wmi.7 for ; Thu, 13 Feb 2020 12:31:48 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f909:7b00:56ee:75ff:fe8d:232b? ([2001:8a0:f909:7b00:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id 59sm4624699wre.29.2020.02.13.12.31.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Feb 2020 12:31:47 -0800 (PST) Subject: Re: [PATCH 58/58] gdbserver: finish turning the target ops vector into a class To: Tankut Baris Aktemur , gdb-patches@sourceware.org References: <10770a54e442c92aa3869813131ac84ecc6890da.1581410936.git.tankut.baris.aktemur@intel.com> From: Pedro Alves Message-ID: <1bf6d99a-abcc-f8cc-9581-f88a27d28acf@redhat.com> Date: Thu, 13 Feb 2020 20:31:00 -0000 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: <10770a54e442c92aa3869813131ac84ecc6890da.1581410936.git.tankut.baris.aktemur@intel.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2020-02/txt/msg00538.txt.bz2 On 2/11/20 9:02 AM, Tankut Baris Aktemur wrote: > @@ -7508,10 +7508,6 @@ linux_get_hwcap2 (int wordsize) > return hwcap2; > } > > -/* The linux target ops object. */ > - > -static linux_process_target the_linux_target; > - ... > #ifdef HAVE_LINUX_REGSETS > void > initialize_regsets_info (struct regsets_info *info) > @@ -7529,8 +7525,7 @@ initialize_low (void) > struct sigaction sigchld_action; > > memset (&sigchld_action, 0, sizeof (sigchld_action)); > - the_target.reset (new process_stratum_target); > - the_target->pt = &the_linux_target; > + the_target.reset (new linux_process_target); So to follow up to the comment in the previous patch, I don't think this is better than the other way around, of keeping the "the_linux_target" global, like GDB does. The global approach has the advantage that auxiliary functions in linux-low.c and siblings can refer to the global without needing to pass around a "this" pointer, for example. This object is a singleton, so should be OK. Thanks, Pedro Alves